- Home /
Character gets reset to center
Hello. I'm currently dealing with a totally bizarre problem. My project (thus far) consists of a flat plane, inhabited by a 3rd person player character and a virtually identical NPC character with simple AI. The problem is that when I press play, the NPC is mysteriously transported to the centre of the scene, and it's somehow being triggered by his animator (if I remove the animator, nothing strange happens). The only difference between the player's and the NPC's animators is the way by which the speed parameter is calculated (input for the player, motion for the NPC), but I don't see how that would change anything. They are both based on the same character that I made in Blender and imported to Unity. The most baffling part is that it was working fine until I modified the walking animation and re-imported the character as an update. Also, changing the culling mode doesn't seem to have any effect. Does anyone have a clue what's happening here?
I think I maybe have answered my own question, albeit it in a roundabout way that I don't even understand myself. I found that if I give the NPC character controller script, the problem goes away, even though I'm not using the script. I guess there's something in there that fixes the problem. Yay.
You should then answer your own question, and click the "Accept answer" button,. So that the question is closed. Its appreciated if you write in detail what solved the problem. To help other with similar problems in the future
It sounds like you may have a unique issue, but I'll insert my copypasta here anyway in case it helps:
Animations contain positional information. Animated objects must be childed to a control object which is moved ins$$anonymous$$d, or their position must be set (not changed, but actually set) in LateUpdate.
Answer by WorldLink · Aug 20, 2013 at 12:04 AM
Ok, it seems that I didn't explicitly state the coordinates of the animation, which is taken care of in the pre-built 3rd person character controller, so Unity automatically assumed that I wanted it to take place at origin. I could have also solved this by parenting the animations to a control object myself (for those of you who are custom building everything).
Your answer
Follow this Question
Related Questions
Optimize Objects 1 Answer
object changes position and rotation to default on play 0 Answers
Object stuck when I add new state in animator 0 Answers
Keeping Quads = 2 materials? 0 Answers
Imported Blender Animations not Working 2 Answers