-2
嗨夥計們,我有一些問題,我的太空船的旋轉。如果我按左箭頭,並切換到右箭頭旋轉即時切換。我如何平滑它?unity3d太空射擊運動
視頻: 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);
}
}