0
我正在为我的项目使用InControl input manager。我正在使用来自右侧棒的输入来旋转我的播放器对象,但我希望播放器能够平滑而不是瞬间旋转。InControl - 如何平滑旋转播放器
这里是我当前的代码:
void FixedUpdate()
{
var device = InputManager.ActiveDevice;
MoveThePlayer(device.LeftStick.X, device.LeftStick.Y);
RotateThePlayer(device.RightStick.X, device.RightStick.Y);
}
void MoveThePlayer(float movex, float movey)
{
body.velocity = new Vector2(movex * speed, movey * speed);
}
void RotateThePlayer(float movex, float movey)
{
float heading = Mathf.Atan2(movey, movex);
transform.rotation = Quaternion.Euler(0f, 0f, heading * Mathf.Rad2Deg);
}
请注明我的答案是正确的或指定什么是错的我的反应。 –