Animation works inside blender but behaves weirdly inside unity

I’ve created custom pistol with basic animation actions ( shoot, reload, equip , etc… ) model hierarchy as shown on picture below.

I’ve also exported this .blend model into .fbx model using settings as shown on picture below.

There is probably something I’ve overseen when creating and connecting armature and/or mesh (apply transform stuff).

  1. Why do my animation actions work inside blender as expected , but apply some weird rotation and offset inside unity over some arbitrary point ??

  2. What is the difference between unity and blender animation execution ? (as i see it somehow blender in pose mode does animations relative to bone positions, while unity stup**ly does animations according to some origin point (couldn’t figure out for the life of me what is that point exactly)

  3. Is there a way to make animations behave in unity same as they do when doing animations in blender pose mode ?

If you need more context to figure out what is the problem with my model, you can download .blend and .fbx files from links below.

.blend file of my model: Upload files for free - glock17 done.blend - ufile.io
exported .fbx used inside unity: Upload files for free - glock17 13.fbx - ufile.io

2 Likes

I only tried exporting as fbx once yesterday when I was trying some AR stuff in Unity. But in the export transform section, I saw that Forward is set to -Z forward. Maybe setting it to Z forward would help.

2 Likes

I’ve no experience in this.

But first I would try to use a gun model without bones etc. Just the object.

1 Like

I’ve found a solution.

First of all let me narrow down the problem:
Problem is to do with model animations inside unity once model is exported into FBX file format - animations execute applying weird position offset and they always lock model’s rotation to -90 on x axis.

Solution:
to get rid of your animations applying offset while playing inside unity, make sure your armature origin point is indeed at 0,0,0 (don’t do it with CTRL-A apply transform position though because that will mess up your bones relative offset)

  1. select your armature and press N
  2. change values under location to be 0 on all 3 (x,y and z) - this will move origin to 0,0,0 with keeping other bones offsets (given that all bones are parented to that armature as in my case , if not you may need to move multiple individual bones by same offset)

to get rid of your animations applying weird rotation to a unity game object:

  1. position your object so that top side of your model is facing +Y axis
  2. position your object so that front part of your model is facing +Z axis
  3. go ahead and now press CTRL+A (apply rotation)
  4. rotate your model 90 degrees on x axis AND DON’T APPLY rotation to your model

Model exported this way (combining 2 steps above) + using FBX export parameters screenshotted above will behave as expected inside unity. Hope this helps.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms