I just started working with Blender and i just made a cube with a animation, it just moves back and forth in one axis basicly. The problem is when i export it to Unity and place it where I want it and add a animation controller to it with my animation the cube moves to Unitys 0, 0, 0 world position. How do I make my animation play wherever i place my object?
On all the tutorials I have watched to try to get an answer to this the person who made the video always puts the object at unitys 0 position but of course you should be able to place it at your desired location?
When i add sample characters that I have downloaded to my scene they animate great and stay at the same position as i put them.
Also: When i scale the object in unity and then hit play the object goes back to its “natural” size.
What is wrong? Something in the export from blender that mess things up?
I use the latest versions of both programs.
Make a empty GameObject ‘G’.
Move the cube under G as its child.
Move G to the place you want the cube to be.
Test the animation again.
Revert to Blender 2.5 or before, this will fix the resetting of the objects position while playing animation until they fix the bug.
This is not a Blender Issue.
You can animate ‘in-place’ or move root within your animation in Blender.
In Unity Legacy animation supports ‘in place’. Use a root-motion animation with legacy and the object will snap back at the end.
Using Mecanim root-motion will work correctly, or you can bake positions in the model import animation tab if you want a root-motion animation to not move the root.
I had trouble with using animated objects made with Blender. Not rigged character animations, but objects with location and rotation animated. The object was misplaced during play no matter where I positioned it with play off. I know the Mecanim can animate it as meat5000 talks about(I’ve used that before but would need a refresher). I want to have a thorough understanding of how things work in Unity. Eventually you want to know it well or else you a lot more mysterious problems like this one.
However for a short term solution I have found that parenting the object ( as zanearn says above) or animating it in Blender with a rig can fix the problem.
I had trouble when I tried to make a prefab from an empty and instantiate it. When I did, there was something wrong. A script node didn’t remember what was assigned to it or something.(can’t remember for sure). However, I got it to work by making a sort of false empty.
Here’s what I did.
- Create a primitive object such as a cube in the hierarchy.
- Then turn off or remove the collider and mesh renderer for the primitive. Now you have an object that can work as an empty but is not really an empty.
- Parent your imported object to the primitive.
- Then you can bring the primitive back to the project window to make it a prefab.
I don’t know if I needed to do this, but I was having trouble otherwise.
***Second Method ***.Another solution is to rig and animate the object in Blender rather than using simple location and rotation animations. (This won’t work for simulations of course. )
Steps: 1. Create one armature bone in Blender and parent the object to it. All vertices will attach to the single bone, so you won’t get any deformations. 2. The location and rotation of the object can then be changed by animating the location and rotation of the bone in “pose mode” just as you would with a character rig.