Search Unity

Freeze Transformations

Discussion in 'Editor & General Support' started by Fibre Optix, Nov 29, 2010.

  1. Fibre Optix

    Fibre Optix

    Joined:
    Mar 10, 2009
    Posts:
    13
    Is there anything in Unity where I can place an object anywhere in 3d space and set it's new transform position to 0,0,0 for scale, transform and rotation?

    thanks
     
  2. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    I'm not quite sure what you mean, but you can reset the transform (or its elements) using the transform component's 'gear' menu in the inspector. Is that what you're looking for?
     
  3. obsidian1269

    obsidian1269

    Joined:
    May 12, 2011
    Posts:
    24
    No, sorry. That just resets it's original position back and physically moves the object. In Maya there is a feature that allows you to "Freeze" the transformations, setting them all back to Zero, without moving the object. I too am in need of this feature!
     
  4. tomvds

    tomvds

    Joined:
    Oct 10, 2008
    Posts:
    1,028
    As far as I understand, you want something like 'reset xform' in max.

    Assuming you need this in editor mode, you would have to write an editor script that applies the current transformation matrix of each mesh to its vertices, normals and tangents (where applicable) and then resets the transforms to zero. This might be a bit tricky if you do not have a lot of scripting experience.

    If your mesh is an animated mesh, this approach won't work. In that case you would need to transform the animation curves, which is quite difficult.
     
    Last edited: May 12, 2011
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    If I understand this correctly, you can get the same effect by putting the object inside an empty parent object and then subsequently using the parent to handle all movement. The child moves within the parent's coordinate space but can be placed anywhere in that space, not necessarily at the <0,0,0> position.
     
    aurorabrown and OrthorsOfficial like this.
  6. Deleted User

    Deleted User

    Guest

    several versions later.....
    Do the transformations in the inspector hinder performance by doing runtime calculations or is there some background engine process that deals with this?

    The reason the OP wanted this is I imagine the same as mine.Freeze Transformations sets the object's initial values to the current ones so that you can reduce the calculations on runtime.Why rotating the thing at the Start func every time you spawn/load it when you can modify it's initial state.
    In case I'm right and the OP's reason was the same as mine,using parenting doesn't improve the result since the calculations are still being done though from a different perspective.

    I wonder if someone from Unity tech can shed some light...