Peter Varga (rationalrats)

5 answers · asked · Lesson: Basic Platform Prefabs · Course: Creating a 2.5D Side Scroller Game in Unity

[SOLVED] freeze transform?

Is there a way (and how to do it)  to "freeze transform" (or apply location/ rotation/ scale to) the mesh imported?

The specific problem here (the platform collider) was solved with a workaround involving an empty object, but I'm more interested in this "generally" (as opposed to the specific)... Also, if there are any benefits to using this approach?

Thanks!

  • crew

    I believe you're asking how to apply the rotation/scale on the object when you export out of a 3d program? These were created in Blender, so in there you would need to apply the rotation and the scale by using CTRL+A which will then pull up a pop up menu allowing you to apply the rotation/scale/location as you'd like. 

    Regarding using an empty game object, I would almost always recommend adding that anyways. I very rarely like to add scripts and components directly to mesh objects. Reason being is that you may want to swap out that mesh object at any time, and/or disable it so it's not visible in game. If you have a lot of components on that object it makes it more difficult to customize in that way. 

    Not only that, but in any situation where you want to control the rotation/position of an object in a different manner than the actual mesh orientation it's much easier to use an empty to control that. If there's something else you were asking about let me know, thanks. 

  • Hi Jonathan,

    Thank you for the prompt response! However, that's not what my question was [intended to be]... : ) 

    Excuse the probable inherent vagueness (of the initial wording) I was trying to be concise above all, but now I see that may have come out at the expense of clarity... So, I'll try like this:

    1. We are confined to Unity only (so, the problem regards 3D objects (imported mesh) and how it is or can be handled within Unity, not an external editor, blender or what have you).
    2. It concerns the concept of "applying transformation" or, freezing (in Maya speak, and, it seems Unity too if I understand the link to follow correctly) so, yes, if the equivalent of the 'Ctrl A' in blender can be performed without leaving Unity in order to "zero out" the transform values without changing the location/ rotation/ scale of the object (vertices) such as the platform piece in the video above. I have since found this:   https://docs.unity3d.com/Packages/com.unity.probuilder@4.0/manual/Freeze_Transform.html and, I believe that that's it; ironically, although it seems I found it, I know so little of the Unity logic and interface at this point that, in this form I cannot even find it (in the UI), let alone use it : D but I do believe that at least the problem discussed is specified by now...
    3. As I've said, I am a COMPLETE noob when it comes to Unity, additionally (in sense of the possible followup), I have to consider the possibility that I'm looking for a Photoshop feature in Illustrator, figuratively speaking : ) and, if that is the case, I appreciate a brief argumentation from the point of view of an experienced user (as in, if it is not possible at all or, possible but not the best practice, why is that and/ or what is the optimal workflow) but, if/ when answering, the 3. is a "sidequest", 1. and 2. the "mainline"... ; )

    Thanks in advance! 

  • crew

    The link your provided is for ProBuilder, which is a tool for building 3d models in Unity, similar to a simplified 3d program but meant for quick prototypes of levels and general layout. Unity itself doesn't have a freeze transform like ability. So the rotation/scale it comes in at into Unity is the default it'll stay with. You can change these in Unity but you can't apply that new change nor reset the original values. 

    Here is the documentation (a bit old) https://docs.unity3d.com/Manual/HOWTO-FixZAxisIsUp.html  that discusses fixing rotations in Unity. They don't really have a tool to apply rotations, it mostly involves adding empty game objects as a parent of which you can then rotate.

    I'll also post a link to this article which may help shed some light on using imported meshes within Unity and ways to "fix" them if need be: https://cgcookie.com/articles/importing-and-exporting-game-assets 

    If you have any other questions let me know, thanks. 

  • Thank you J!

    That pretty much draws a full map for me, after some ping- pong; so, to summarise: We do our mesh edits OUTSIDE of Unity and handle any needed manipulation [within] via empties (so, not a workaround as I have assumed, but the legit, only way to go about it). Apologies if this is all too obvious and a time waste (for yourself or anyone who"s happened to end up reading this); as I've stated earlier> uberN00b here! : ) 

    Closing (marking as [SOLVED])... if there is a different convention (or any at all) for doing this, do let me know!

    Cheers!

  • crew

    No worries, glad I could help you better understand the concept. If you have any other questions feel free to ask!