Hallo Leute, ich habe ein paar Probleme mit der Rotation meines Raumschiffs. Wenn ich den Pfeil nach links drücke und auf den Pfeil nach rechts wechsle, wird die Drehung sofort umgeschaltet. Wie kann ich es glätten?unity3d spaceshooter Bewegung
Video: https://sendvid.com/fek9izy3
void FixedUpdate()
{
Rigidbody rb = GetComponent<Rigidbody>();
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.velocity = movement * speed;
rb.position = new Vector3
(
Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp(rb.position.z, boundary.zMin, boundary.zMax)
);
rb.rotation = Quaternion.Euler(0.0f, 180, rb.velocity.x * -tilt);
}
}