Commit 7a3463f5 by Jonathan Thomas

Smooth out sneak motion, so text bubble does not jump

parent eeec9218
Pipeline #11650 passed with stage
in 19 seconds
...@@ -150,9 +150,14 @@ public class ClientInit implements ClientModInitializer { ...@@ -150,9 +150,14 @@ public class ClientInit implements ClientModInitializer {
// Get camera position // Get camera position
Vec3d interpolatedCameraPos; Vec3d interpolatedCameraPos;
double cameraHeight = 0D; double cameraHeight = 0D;
double sneakHeight = 0.3D;
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)
if (cameraEntity.isSneaking()) {
cameraHeight = cameraEntity.getHeight() + sneakHeight;
} else {
cameraHeight = cameraEntity.getHeight(); 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), MathHelper.lerp(partialTicks, cameraEntity.prevY, cameraEntity.getPos().y),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment