Why when I place a mesh that has an animation which is going to loop at a spot , I hit play, then it resets to Unity’s default spawn point while looping the animation?
Thanks.
Why when I place a mesh that has an animation which is going to loop at a spot , I hit play, then it resets to Unity’s default spawn point while looping the animation?
Thanks.
Well, I’m just guessing here since I don’t know exactly what you did and you didn’t attach a project file. It really depends on how you created the animation and imported it into unity. If you have keyframes in your animation that actually move your character, it will move inside Unity. Lets say your character walks and moves 5 units forward in your animation. When you import it to Unity 2.5 and place it in the scene most likely you will see the last frame of the animation (if I’m not mistaken…). If you place it in 0,0,0 in the Unity game world, since the last frame is when your character is 5 units forward from its starting position, in Unity you will see it as if it’s on 0,0,5. Notice the gizmos you use to move and rotate the character… They should be at 0,0,0 althought the character will appear to be 5 units away from them.
If you want to create a walking cycle, for example, what you need is to have the character walk in place. You take care of the actual movement inside Unity.
If this is way off base, and I’m wrong assuming this is your issue, just add some more details… What is the animation?, are there any scripts attached to the gameObject? How is the animation played (are you using a script to start it, or is it just marked as “play automatically”?
If you’re using Unity 2.1, you can display the animation layout and scrub through the animation even if you’re not in play mode, so you can see exactly what happens.
My animations all involve game objects in the world like obstacles, switches, spinning pick up items, etc. Some work but some dont for some reason. I even added bones to see if that was the problem. Some worked but some didnt.
If some work and some don’t, I imagine it’s something really specific to those animations. You say you tried adding bones, and Unity can definitely handle bone animations… And you’re not getting any errors in the console when you import those animations into Unity?
Can you maybe post a sample animation here that didn’t work for you? Maybe export a small version of just one scene with one of the animations that didn’t work?
What 3d package are you using? If it’s Maya, 3dsMax or Lightwave I can maybe try opening the original file on my machine.
In case you’re exporting the animation to FBX and importing the FBX into Unity, make sure you’re using the latest version of the FBX plugin. It can cause a LOT of headaches if you’re using an older version.
Hello,
I’ve got almost the same problem. When i create an object with an animation and place it in unity, when i hit play it jumps back to 0,0,0 and unity plays the animation there, when set to autoplay.
I tried activating te animation with a script but when the animation starts playing it jumps back to 0,0,0 also the scale of the object goes back to 1,1,1. The rotation also jumps back to its original to what is was when i imported it 270,0,0
I use Unity 2.5 on a Windows platform, for 3d software i tried 3ds max 2009, 3ds max 2009 + sp1, 3ds max 2010 + sp1… all the same problem.
The animation is a basic test animation, a small rotation and en translation upwards…
I also tried to save the position of the object, play the animation and set the position back to the first saved position… no effect…
I’m planning on building an animation in maya and see if i have more luck…
Any help is appriciated
I assume your animation animates the root transform of your object. Try making a parent gameobject containing the gameplay logic for the gameobject, and make the animating mesh a child of that. Then your animation will be relative to that, and shouldn’t reset the objects position.
Im going to try that. But why would this be happening though? A bug?
Not a bug, just how the animation is set up in your 3d modeller. If it animates the object to start at {0,0,0}, that is what the animation will do. If you just animate child nodes, then the root will stay at wherever you put it.
OK, that was solved with the game object parenting tip you gave, thanks.