Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
eeec9218
Commit
eeec9218
authored
Nov 06, 2023
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix camera pitch when close to entity or looking up in both 1st and 3rd person views.
parent
8982b58c
Pipeline
#11649
passed with stage
in 20 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
ClientInit.java
src/client/java/com/owlmaddie/ClientInit.java
+5
-5
No files found.
src/client/java/com/owlmaddie/ClientInit.java
View file @
eeec9218
...
@@ -149,18 +149,18 @@ public class ClientInit implements ClientModInitializer {
...
@@ -149,18 +149,18 @@ public class ClientInit implements ClientModInitializer {
// Get camera position
// Get camera position
Vec3d
interpolatedCameraPos
;
Vec3d
interpolatedCameraPos
;
double
cameraHeight
=
0
D
;
if
(
MinecraftClient
.
getInstance
().
options
.
getPerspective
().
isFirstPerson
())
{
if
(
MinecraftClient
.
getInstance
().
options
.
getPerspective
().
isFirstPerson
())
{
// 1st person, Use the cameraEntity (interpolate for smooth motion)
// 1st person, Use the cameraEntity (interpolate for smooth motion)
cameraHeight
=
cameraEntity
.
getHeight
();
interpolatedCameraPos
=
new
Vec3d
(
interpolatedCameraPos
=
new
Vec3d
(
MathHelper
.
lerp
(
partialTicks
,
cameraEntity
.
prevX
,
cameraEntity
.
getPos
().
x
),
MathHelper
.
lerp
(
partialTicks
,
cameraEntity
.
prevX
,
cameraEntity
.
getPos
().
x
),
MathHelper
.
lerp
(
partialTicks
,
cameraEntity
.
prevY
,
cameraEntity
.
getPos
().
y
)
+
cameraEntity
.
getHeight
()
,
MathHelper
.
lerp
(
partialTicks
,
cameraEntity
.
prevY
,
cameraEntity
.
getPos
().
y
),
MathHelper
.
lerp
(
partialTicks
,
cameraEntity
.
prevZ
,
cameraEntity
.
getPos
().
z
)
MathHelper
.
lerp
(
partialTicks
,
cameraEntity
.
prevZ
,
cameraEntity
.
getPos
().
z
)
);
);
}
else
{
}
else
{
// Use the camera (3rd person)
// Use the camera (3rd person)
interpolatedCameraPos
=
new
Vec3d
(
camera
.
getPos
().
x
,
interpolatedCameraPos
=
new
Vec3d
(
camera
.
getPos
().
x
,
camera
.
getPos
().
y
,
camera
.
getPos
().
z
);
camera
.
getPos
().
y
,
camera
.
getPos
().
z
);
}
}
// Get all entities
// Get all entities
...
@@ -199,7 +199,7 @@ public class ClientInit implements ClientModInitializer {
...
@@ -199,7 +199,7 @@ public class ClientInit implements ClientModInitializer {
// Translate to the entity's position
// Translate to the entity's position
matrices
.
translate
(
interpolatedEntityPos
.
x
-
interpolatedCameraPos
.
x
,
matrices
.
translate
(
interpolatedEntityPos
.
x
-
interpolatedCameraPos
.
x
,
interpolatedEntityPos
.
y
-
interpolatedCameraPos
.
y
+
entity
.
getHeight
(
)
+
paddingAboveEntity
,
(
interpolatedEntityPos
.
y
+
entity
.
getHeight
())
-
(
interpolatedCameraPos
.
y
+
cameraHeight
)
+
paddingAboveEntity
,
interpolatedEntityPos
.
z
-
interpolatedCameraPos
.
z
);
interpolatedEntityPos
.
z
-
interpolatedCameraPos
.
z
);
// Calculate the difference vector (from entity to camera)
// Calculate the difference vector (from entity to camera)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment