I have a number of objects (mostly prefabs) that have their transform origin in inconvienient places such as about 1 unit to the left of the actual geometry or somewhere inside an object where it's hard to see. Is there any way to move these transforms without actually moving the object itself? This is in 3D.
-
\$\begingroup\$ please consider this topic. It says that you need provide pivot value for your models in your 3d editor \$\endgroup\$– Leggy7Commented May 28, 2015 at 12:34
-
\$\begingroup\$ Note that moving an object's transform always moves the geometry; that's what the transform is there for. What you're really intending to ask is whether there's a way of moving the object's geometry relative its transform. \$\endgroup\$– Trevor PowellCommented Jun 28, 2015 at 5:04
1 Answer
The easiest way is to create a new empty game object at the location & orientation you want for the origin. Then re-parent the game object containing the geometry (and anything that goes with it) to your new empty game object. Finally, name the game object appropriately and drag it into your Project window to save a prefab with the corrected origin.
If the current parent object has some content that needs to stay at the top transform level, you can either duplicate it to the new object, or move its child objects within it by:
- reparenting its child objects to the scene root
- moving the parent object to the location where you want the origin
- reparenting the former child objects back to the parent
Of course, the most robust method is as @Leggy7 says in a comment above: re-export your geometry from your 3D package so that the origin is exactly where you want it. I mention these other options in case you just need a quick fix, or don't have access to the source asset or 3D software to edit it.
If you only need the origin to appear somewhere different in the scene editor, you can use the Gizmo Display Toggles to display the transform gizmo at the center of the object's bounding box, rather than at the origin of its local coordinate space.