it was in radians

pull/12/head
valoeghese 2020-02-28 21:10:54 +13:00
parent e72828cbde
commit cfb98c412c
1 changed files with 8 additions and 4 deletions

View File

@ -32,12 +32,14 @@ public class Player extends RenderObject
position.x -= Math.sin(ry) * Constants.movementSpeed;
break;
case LEFT:
position.z -= Math.cos(ry + 105) * Constants.movementSpeed;
position.x += Math.sin(ry + 105) * Constants.movementSpeed;
ry -= NINETY_DEGREES;
position.z -= Math.cos(ry) * Constants.movementSpeed;
position.x += Math.sin(ry) * Constants.movementSpeed;
break;
case RIGHT:
position.z -= Math.cos(ry - 105) * Constants.movementSpeed;
position.x += Math.sin(ry - 105) * Constants.movementSpeed;
ry += NINETY_DEGREES;
position.z -= Math.cos(ry) * Constants.movementSpeed;
position.x += Math.sin(ry) * Constants.movementSpeed;
break;
case UP:
if (this.noWeight) position.y += Constants.movementSpeed;
@ -49,6 +51,8 @@ public class Player extends RenderObject
}
}
private static final float NINETY_DEGREES = (float) (Math.PI / 2f);
private void jump()
{
if (!isInAir)