- Home /
Question by
IPS · Feb 20, 2013 at 10:51 PM ·
c#rotationrotatearound
Rotate Around by 90 Degrees
Is there a way to use the RotateAround function by a certain amount of degrees
For example, I have:
transform.RotateAround(v3Pos, transform.right, Time.deltaTime * speed);
How would you modify this code to rotate by 90 degrees in the right direction and then stop?
Comment
Answer by DaveA · Feb 20, 2013 at 10:56 PM
Before rotation begins, get the euler angle around which you are rotating (looks like X), then in update check to see if current angle is >= that angle+90 (mod 360 of course)
Hi Dave,
Is there no way of doing it without checking the angle? The reason why I say this is because I have already tried it and although it works it fails at checking other angles when new rotations are played out (like rotating back to its original position). The reason why I ask this is because I'm trying to avoid checking the angle.