Quantcast
Channel: Questions in topic: "quaternion.slerp"
Viewing all articles
Browse latest Browse all 133

Object rotate and slowly stop to toward

$
0
0
Hello. I want to rotate object by z axis. Here is my code. [SerializeField] GameObject obj = default(GameObject); float _lotationSpeed = 50f; float _stopAngleZ = default(float); // determine stop angle z (range: 0 ~ 360) void StopRotate() { _stopAngleZ = 270f; // for example.. _status = GameStatus.Stopping; } void Update() { switch(_status) { case GameStatus.Rotate: obj.transform.Rotate(Vector3.back * _lotationSpeed); break; case GameStatus.Stopping: // TO-DO: rotate speed deceleration // TO-DO: change status Stopping -> Stopped break; case GameStatus.Stopped: // game end.. break; } } I already search same name. But I can't find a solution. How can I slowly stop to toward? (! important, I don't want to reverse rotation, keep a same direction)

Viewing all articles
Browse latest Browse all 133

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>