So I have a basic understanding of Java, but im new to javascript. So if you guys could help me out a bit, i want an object in this case a cube to rotate 180 degrees over a period of time.
So i use this basic command
function Update() {
transform.Rotate(0, 18 * Time.deltaTime, 0);
}
To rotate it 18 degrees every second. But i want the rotation to stop after 180 degrees, so i tried putting it into a loop but that didnt work.
So how should i do this, is this the best way or is there a smarter way?
I would suggest using the LERP and SLERP commands and quaternions.
Just give it a start point, target point, and a timeframe to do it and it will make a nice smooth animation from start to target over the alloted time.