- Home /
Rotate object around object with fixed value.
Hello,
with Transform.RotateAround() we can rotate one object around another object with a given angle.
How can you rotate an object around another object with a set fixed rotation? For example, how can you rotate an object so that it is exactly 30° rotated around the x-axis of an object but stays there?
If we use transform.RotateAround(Vector3.zero, Vector3.left, 30) but call this function each frame, then the object gets rotated infinitely around the object. How can you "define" the rotation to be equal to 30° without changing the rotation based on its current rotation?
Thanks for any help!
Answer by highpockets · Oct 04, 2020 at 11:45 AM
RotateAround() is just a function that rotates around a point in space on an axis by the degrees you declare. If you just want it to rotate around by 30 degrees and stay there, just call the function once
I’m imagining that you are calling this in the update function. If you are expecting the object to rotate around another object by 30 degrees smoothly in steps you should have count the degrees you move over time and once you get to 30 degrees, stop calling the function..