Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Help with importing mesh and animation from blender.

Discussion in 'Asset Importing & Exporting' started by iScream8, Feb 16, 2015.

  1. iScream8

    iScream8

    Joined:
    Feb 16, 2015
    Posts:
    10
    I've made an animated book by using this tutorial but whenever I import this on unity the animations just don't work properly also the mesh always overlaps with the animation. I don't know what I'm doing wrong. :( I've tried watching several tutorials in exporting and importing but I still can't get it to work. -_- I really need this badly for our school project and been following the animated book tutorial for weeks now so I really hope someone could help me with this.

    Here's the .blend file.
     
    Last edited: Feb 16, 2015
  2. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    I like the animation, pretty complex. I think the problem is going to be the fact that Blender and Unity don't have exactly matching features. Unity can only use bone animations, and only rotation ones at that. It doesn't know about contraints, etc... though those things can be used to make it easier to create animations, if the animation can't get baked down to just bone rotations of some for, it won't work. IK is the same, you can use it to decide where to rotate the bones, but the IK itself won't directly go to Unity.

    The other issue is that though Unity now has some support for Blend Shapes(Shake Keys), it doesn't work directly like that. The actual shape keys(as in the extents the verts move) can get imported into Unity, and then by code you would have to actually change those values. The animations of the shape keys that gets in Blender via animation keyframes won't get exported to Unity, as this is a Blender specific thing. That is the main problem using the Lattices to create animations, as Unity is best with bone animations. Like I say though, if you have those things set as shape keys, you can indeed do it in Unity, but you have to code it.

    Last thing, I'm not sure how well the modifers can all work as applied. Some of them are fine to export as applied because they don't change frame by frame. For example, you could keep the subsurfs just fine, as it can get applied once and stay the same frame to frame. But things that change, like those Shrink Wraps for example, won't work right. The exporter can normally apply a modifier upon export, so what will happen is that the shrink wrap gets applied, and doesn't ever change. Afterwards.

    Honestly, I hate to say it, but I think your best best if you intend on getting it to work in Unity is going to be to redo it completely using nothing but armatures. It won't be all that fast having to many bones, but it is probably fast enough. You would have a bone chain for each "cluster" of pages. The amount of bones in the chain would determine how many bones you need.

    I have linked below to a really quick blend I made. It is far from production ready and is therefore not as good as what you have already. You would want to just look at how I did it and then do it taking the time to do it better with better vertex group weights, etc... on your own. This file just shows you how you can do similar things without having to resort to nice modifiers, and this method, though I'm using IK chains to help place the bones instead of rotating bone by bone, it should still export fine to Unity because it only uses bone rotations in the end. Take a looksy.

    https://dl.dropboxusercontent.com/u/88984573/pages.blend
     
  3. iScream8

    iScream8

    Joined:
    Feb 16, 2015
    Posts:
    10
    Thank you so much for replying, kburkhart84! Aww, so I'm pretty much back to square one I guess? :/ It's a shame that I can't really make this work in unity :( I've been doing this for a while now but atleast I got to know why it wasn't working well when imported to unity. I'm really really a beginner on blender it's just I need it for a game app so I quickly started that tutorial without researching more about blender. Okay so I should just stick to these bones armatures. IK chains are pretty much new to me too so I guess I've got no choice but to research first..
     
  4. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    Yup, IK is great. It is one of the few things that is Blender specific but still applies to be used for Unity. I would use it just to help to rotate bones. Just consider the leg. You have a bone for the upper leg, the lower leg, and likely one for the foot. If you do things the "normal" way using only FK(forward kinematics), you would need to position the leg rotating each bone into place, first the upper, than the lower, finally the foot. If you use IK instead, you can move only the foot, and and the upper and lower leg bones will rotate automatically. Just grab and move the final bones in the chain of the book I sent you to see what I mean.

    The IK itself won't work in Unity, though you can use Unity's IK for Mecanim models, or code your own or get from the asset store code that does the IK for you. But....you can still use the IK to help rotate the bones. It is just like you can't use Blender's procedural textures in Unity. But, if you UV map your mesh, you can use the procedural textures to help paint the actual final texture, which can then be saved and loaded into Unity for the model.
     
  5. iScream8

    iScream8

    Joined:
    Feb 16, 2015
    Posts:
    10
    thank you so much for some clues. I'll try that one! :)