I am making a 2D platformer. On the press of a button I need the world to rotate 360 degrees around the players feet.
I have all platform cubes in a Level Object. I have a rotate script to roate the parent Level object.
However this is in the middle of the world. I need the world to rotate at the players co-ordinate so it looks like the world is spinning at its feet.
Please can anyone help. I am at a Game Jam and only 12 hours left
Thanks in advance.
You can create a separate parent transform that can act as a pivot rotation. To move the pivot you will have to move the game object and the pivot object in opposite directions, then rotate the Pivot.
Here is an example using a Plane that I would like to rotate around it’s corner.
- GameObject->Create Other->Plane
- GameObject->Create Empty
- Rename GameObject to Pivot
- Make Plane a child of Pivot
- Move the Plane transform to X= 5, Z= 5
- Move the Pivot transform to X= -5, Z= -5
- Rotate the Pivot object. It will now rotate the Plane around it’s corner.
Note that the transform of the Pivot object is the center of rotation… so if you want to move the center of rotation by 5 units, move the pivot object by 5 units and correct in the child.