I have simple scene and movement script. When I move my character stutters and when I go diagonal it doesnt truely goes diagonal.
{
Vector3 direction = Vector3.Zero;
// Tuşlara göre yön belirleme
if (Input.IsActionPressed("MoveForward"))
direction.Z -= 1.0f;
if (Input.IsActionPressed("MoveBackward"))
direction.Z += 1.0f;
if (Input.IsActionPressed("MoveLeft"))
direction.X -= 1.0f;
if (Input.IsActionPressed("MoveRight"))
direction.X += 1.0f;
if (direction != Vector3.Zero)
{
//Normalize to not move faster when moving diagonally
direction.Normalized();
//Multiply by delta to make the movement smooth and by 8 to make it faster
direction *= (float)delta * 8;
//Rotate the direction to the player's rotation
direction = direction.Rotated(Vector3.Up, PlayerHandler.getPlayer(0).Rotation.Y);
//Move the player
PlayerHandler.getPlayer(0).MoveAndCollide(direction);
}
}```