mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 06:18:00 +01:00
Better barrel roles! This should be less likely to break on diagonals.
This commit is contained in:
parent
d3efbc5c05
commit
3aedf474ba
1 changed files with 8 additions and 5 deletions
|
@ -50,14 +50,17 @@ public class RenderPonyPlayer extends RenderPonyBase {
|
||||||
GlStateManager.rotate(ponyModel.motionPitch, 1, 0, 0);
|
GlStateManager.rotate(ponyModel.motionPitch, 1, 0, 0);
|
||||||
|
|
||||||
double horMotion = Math.sqrt(motionX * motionX + motionZ * motionZ);
|
double horMotion = Math.sqrt(motionX * motionX + motionZ * motionZ);
|
||||||
|
|
||||||
if (horMotion > 0) {
|
if (horMotion > 0) {
|
||||||
yaw = (player.cameraYaw - player.rotationYaw) % 360;
|
|
||||||
|
yaw = player.cameraYaw - player.rotationYawHead;
|
||||||
|
|
||||||
double roll = (Math.toDegrees(Math.atan2(motionX, motionZ)) - yaw) % 360;
|
double roll = (Math.toDegrees(Math.atan2(motionX, motionZ)) - yaw) % 360;
|
||||||
|
|
||||||
if (roll > 180) {
|
if (roll < -180) roll += 360;
|
||||||
roll -= 360;
|
|
||||||
}
|
roll *= horMotion * 2;
|
||||||
roll = MathHelper.clamp(roll, -44, 44) * horMotion * 2;
|
roll = MathHelper.clamp(roll, -54, 54);
|
||||||
|
|
||||||
GlStateManager.rotate((float)roll, 0, 0, 1);
|
GlStateManager.rotate((float)roll, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue