- Home /
Object disappearing after playing animation.
So I'm having a weird issue when I play an animation. I created a simple cube and simple "flipping" animation with it in Maya. I exported it as .FBX. When I bring it in to unity and leave "play automatically" checked, it will disappear off of the screen when I press play. Then it reappears after the game is stopped. I made a GUI with a button to press to make the cube flip, using it's animation. The GUI script is attached to the Main Camera. With the scripts attached I uncheck "Play automatically" and when I press the button, it disappears still.
I've tried animation.Play();, or animation.AddClip();, And I'm coding in C# with this project. Any help would be great thanks!
I'm having the same problem, and It's driving me nuts.
$$anonymous$$ake sure you have an object in your scene with "Root" in the name and export that with your object.
Answer by Baalhug · Sep 18, 2013 at 05:47 AM
The solution to this problem is easy. Look for the object which has the component "Animator". Usually it's the package folder of your mesh/animation. In that component look for a checkbox called "Apply Root Motion". Uncheck it. You're ready to go.
Actually your mesh dont disappear, but it moves to a different coordinate, probably 0,0,0. When you uncheck that option you're telling unity not to use the coordinates the animation already has, and it will use the ones from its mesh.
Where is the checkbox? If you can provide the answer please do it because I can't seem to figure it out!
Answer by lyzard · Jul 10, 2012 at 07:32 PM
it's maybe be related with the pivot point of your object, which moves your object elsewhere when you play, I don't know for Maya, but on blender, I make sure to recenter my object before exporting, can you check that ?
Answer by Kurpowski86 · Jul 10, 2012 at 08:07 PM
Well the pivot point is right at the center of the cube
hmm, it could be about the translation of the object when you export, I don't know $$anonymous$$aya at all, but with blender I have to "clear location" before exporting. Check also if your object is not translated anywhere ins$$anonymous$$d of just disappearing, if yes, this can give you a clue. There may be a workaround with parenting : http://forum.unity3d.com/threads/45026-$$anonymous$$esh-With-Animation-Relocates-at-Runtime
Answer by Kurpowski86 · Jul 10, 2012 at 08:32 PM
Well I just noticed something strange. What happens is that when I press the button, it flips which is great, but.. it rescales it down to like a microscopic size. Because When I brought it into unity I had to rescale it for it to be clearly seen in the editor. But why would it shrink it down to such a small size to play the animation? Is it because in the animation its that size, so when it plays it forces back to its original state?
I guess yes, you can try changing the scale when importing (in the inspector) or directly in $$anonymous$$aya. Try to see if that solves the pb. Btw, you should add comments rather than creating new answers for your problem ;)
When I import it though it doesn't allow me to adjust the scale of the x,y,z, only the scale factor which is set at 1 right now. I changed that to 500 and it did nothing..
Sorta figured it out, I just changed the scale factor to like 200, and it started to work. I think that it rescales it to its original size of 1,1,1 or whatever it maybe. But when I changed the scale factor it multiplied that I think? So it started looking normal, thankfully.