- Home /
C# Rotate GameObject at Other Point other than Center
Is there a way to adjust where a gameobject is rotated? I would like to rotate a gameobject at a different point other than the center of the gameobject.
Answer by Mark Gossage · Jun 29, 2015 at 12:28 AM
Three ways:
Complex Math to translate, rotate & translate.
Create a empty game object called 'pivot', attach your game object to pivot, then move & rotate pivot rather then the game object.
Using your favorite 3d modelling tool, edit the pivot point/origin for the model you are working with.
Answer by LightDrake · Jun 29, 2015 at 10:19 AM
At the top left, you should see a button called "Center", left click it once and it should change to "Pivot"; If it keeps rotating at the center still, you need to open up the model into a 3D modelling application and set the pivot point where you wish.
Answer by Cherno · Jun 29, 2015 at 12:27 AM
The pivot of a gameobject can't be changed in Unity. this is commonly done in a 3D modelling application. However, you can use an existing, or create a new, gameobject in your scene (even an empty one) and make it a parent of the gameobject that should be rotated, using the parent object as a pivot point. Now you can rotate the parent and the child will roate around the parent, i.e. the rotation point.
Edit: There's also Transform.RotateAround.