Unity randomly re-positions game objects on play?!

Someone please help!

I’ve dragged an animated prefab into my scene, and positioned it. But when I hit play, Unity instantly moves the object to a completely different position a million miles away!

Anyone know why this is happening?

Thanks!

We need a little more information. Do you have any scripts on your objects?

Check your animated object that the root’s position wasn’t animated in modeler accidentally.

No, no scripts on this one. It’s just a plane made up of 16 polys exported from Maya as an FBX. Literally all I’ve done is import it into Unity, drag it into my scene, rescale it, and reposition it.

I’m not sure what this means, but I will investigate!

He means that if you’ve animated the root of the object (ie, the base or highest node in the hierarchy) when you get it to start animating in Unity, the animation will override the position you’ve given it. It’s a fairly common mistake and it comes up regularly on the forum.

Also, wording is important - if your object is being randomly repositioned, then it’s an entirely different issue. If you just mean it’s moving unexpectedly when the animation starts, my money would be on an animated root.

It sounds like your animations are animating the root of the object, instead of a child.
Animations has no idea of hierarchy. They just have data of positions etc.
If you have the animation file working on an object with world as its parent, then positions will be world positions. If you then place the object as child to another object, then animations will be relative to this. So look at your animations. I’m sure they have positions in the millions, if that is indeed where they place your model.
Make sure to have your animations in your 3d app around 0,0,0, or have a root bone in 0,0,0 which aren’t animated. Then it would work perfectly…

Unity doesn’t support blendshapes.

How have you animated it?

Oops, typo in my original statement. Edited to fix it.

And a small favor, could we not quote me for things I didn’t say. :smile:

Are you sure your camera is pointing to the right place? :wink:

I was under the impression that when you export an FBX, the position of the vertices on each frame is baked into the mesh data, with all history of the blendshape effectively destroyed. Does that mean Unity only supports animations if they’re based on a skeleton?! That seems ridiculous for simple animations.

Oh well, off I go to make a rig.

Yes, you have to make a rig. Unity only imports skeletal animation.

And one more time, even if you quote someone who quoted me wrong, please fix it in your post. :smile: I don’t remember saying half the stuff I am quoted for. Oh well. :smile:

Sorry about that! Quote tags got mixed up :sweat_smile:

I’m not sure what you mean with this comment but i’ve been successful at importing animations without a skeleton rig. This was done using 3DS Max 2010.