hey
var speeds = speed;
if(Keyboard.keyPressed(Keyboard.SHIFT))
{
speeds += sprint;
}
//Move player using WASD
if(Keyboard.keyPressed(Keyboard.W))
{
player.velocity.x = speeds * Math.sin(camera.mouseRotation.x);
player.velocity.z = speed * Math.cos(camera.mouseRotation.x);
}
if(Keyboard.keyPressed(Keyboard.S))
{
player.velocity.x = -speeds * Math.sin(camera.mouseRotation.x);
player.velocity.z = -speeds * Math.cos(camera.mouseRotation.x);
}
if(Keyboard.keyPressed(Keyboard.A))
{
player.velocity.x = speeds * Math.sin(camera.mouseRotation.x + MathUtils.PID2);
player.velocity.z = speeds * Math.cos(camera.mouseRotation.x + MathUtils.PID2);
}
if(Keyboard.keyPressed(Keyboard.D))
{
player.velocity.x = -speeds * Math.sin(camera.mouseRotation.x + MathUtils.PID2);
player.velocity.z = -speeds * Math.cos(camera.mouseRotation.x + MathUtils.PID2);
}
ok so this is the movement scripts… but i cant move left and foward at the same time
do u know how i can make this better?