Hi there, a quick question about rotation and rotation around.
The picture attached maybe isn’t very clear, I have clusters of objects within a sphere, then multiples of those clusters within a larger sphere.
Each object has rotation around it’s own centre. Each object then needs to rotate around the local cluster centre, then each cluster needs to rotate around the world centre. And it’s possible there might be multiples of these. All rotation directions are arbitrary at the moment.
Each object’s rotation is simple enough, but I’m getting confused with rotateAround and what the vectors actually are.
I’ve done this before in other engines with simple trig, but this doesn’t equate to vectors and quaternions in my head.
Does anyone have a simple example of how this is done? Would it be easier to move the objects centre point and rotate?
Thanks.
Hi @tclancey ,
I think you forgot to attach the picture.
I don’t have a clear idea of what you’re trying to accomplish, but my recommendation is to try to structure the hierarchy (in the Hierarchy window) of your spheres carefully.
That’s because all the game objects that are children of a specific parent, will automatically inherit the rotation of such parent and therefore will automatically rotate around him, so you don’t have to worry at least of the rotations around the parents in your code.
Regarding the RotateAround method, is pretty straight forward, you just have to pass in order:
- A point in the world space where your game object to rotate around (p.e.
transform.position
will make your object rotate around himself with no translation);
- The axis to be used for the rotation (p.e.
Vector3.up
will make your object to rotate around the y-axis)
- Finally, the degrees that you want your object rotate (p.e. if you use
Time.deltaTime * 1
inside of the Monobehaviour.Update
method, your game object will rotate one degree per second)
Good luck with your project!