Skip to content

Commit

Permalink
Fixed camera turning at slower speed when framerate is lower
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCrayfish committed Feb 12, 2020
1 parent f2ea7d2 commit 56c03d6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ public void onRender(TickEvent.RenderTickEvent event)

if(mc.currentScreen == null && (targetYaw != 0F || targetPitch != 0F))
{
player.rotateTowards(targetYaw, targetPitch * (Controllable.getOptions().isInvertLook() ? -1 : 1));
float elapsedTicks = Minecraft.getInstance().getTickLength();
player.rotateTowards((targetYaw / 0.15) * elapsedTicks, (targetPitch / 0.15) * (Controllable.getOptions().isInvertLook() ? -1 : 1) * elapsedTicks);
if(player.getRidingEntity() != null)
{
player.getRidingEntity().applyOrientationToEntity(player);
Expand Down Expand Up @@ -336,7 +337,7 @@ public void onRender(TickEvent.ClientTickEvent event)
if(!MinecraftForge.EVENT_BUS.post(turnEvent))
{
float deadZoneTrim = (controller.getRThumbStickXValue() > 0 ? 1 : -1) * deadZone;
float rotationYaw = (turnEvent.getYawSpeed() * (controller.getRThumbStickXValue() - deadZoneTrim) / (1.0F - deadZone)) * 0.5F;
float rotationYaw = (turnEvent.getYawSpeed() * (controller.getRThumbStickXValue() - deadZoneTrim) / (1.0F - deadZone)) * 0.33F;
targetYaw = rotationYaw;
}
}
Expand All @@ -348,7 +349,7 @@ public void onRender(TickEvent.ClientTickEvent event)
if(!MinecraftForge.EVENT_BUS.post(turnEvent))
{
float deadZoneTrim = (controller.getRThumbStickYValue() > 0 ? 1 : -1) * deadZone;
float rotationPitch = (turnEvent.getPitchSpeed() * (controller.getRThumbStickYValue() - deadZoneTrim) / (1.0F - deadZone)) * 0.5F;
float rotationPitch = (turnEvent.getPitchSpeed() * (controller.getRThumbStickYValue() - deadZoneTrim) / (1.0F - deadZone)) * 0.33F;
targetPitch = rotationPitch;
}
}
Expand Down

0 comments on commit 56c03d6

Please sign in to comment.