Search Unity

Stretching model when rotating

Discussion in 'Animation' started by SeaPeaMe, Jul 6, 2021.

  1. SeaPeaMe

    SeaPeaMe

    Joined:
    Jan 23, 2018
    Posts:
    28
    Hello everyone!

    I'm having a problem when exporting from blender to Unity where the model of a shotgun shell seems to stretch on every axis except for the local Z. (see video below)
    2021-07-06-12-25-51-Trim.gif

    Please note that the rotating is fine in blender and applying transforms does not work, it just stretches them on import

    Any help would be appreciated!
     
  2. Goatogrammetry

    Goatogrammetry

    Joined:
    Apr 27, 2017
    Posts:
    197
    The object's parent is scaled at something not 1:1:1 so thats the kind of thing you get. The reason is that every descendant lives in a world with a coordinate system that comes from the parent's world. So imagine you have a grid. Scaling unevenly causes the squares in the grid to be rectangular. Now a child object tries rotating in that grid. From its point of view, the squares are square, but from outside that child's world, we know they're squashed and rectangular. Kinda like if you travel near the speed of light you flatten out like a pancake, but to you you're fine and everyone else is stretched long.
     
    gentkrass and Gburgess0012 like this.
  3. SeaPeaMe

    SeaPeaMe

    Joined:
    Jan 23, 2018
    Posts:
    28
    Good to know, but is there an easy way to fix it?
     
  4. Goatogrammetry

    Goatogrammetry

    Joined:
    Apr 27, 2017
    Posts:
    197
    Well the first and best way is to not scale objects unevenly in a bone chain. Animators are very careful with scale since its so dangerous.

    The other way is to modify the child's matrix before you do any translation. You have to back-out all the parent objects' scaling issues. You may have to do that in conjunction with the rotations too. But I'm no programmer so I cant say how its done. My understanding is its not super hard if you know your matrix math.
     
  5. SeaPeaMe

    SeaPeaMe

    Joined:
    Jan 23, 2018
    Posts:
    28
    Okay, I'll try both methods... Thanks for the help!
     
  6. KalOBrien

    KalOBrien

    Administrator

    Joined:
    Apr 20, 2021
    Posts:
    89
    If you go to the parent object you can click the three dots on the top right of the component for Transform and click reset.

    Might be beneficial to shift click the entire hierarchy for the bullet and reset it also and then just scale it from the parent gameobject.