Search Unity

Animating child GameObject position causes the parent object to stutter or float

Discussion in 'Animation' started by Fellshadow, Apr 23, 2014.

  1. Fellshadow

    Fellshadow

    Joined:
    Dec 2, 2012
    Posts:
    169
    When animating the position of a child GameObject, it causes the parent GameObject to stutter when moving or float up into the air if Apply Root Motion is turned on. I've been struggling with this for hours and have not been able to find any solution.

    Here is what I'm doing:
    I have a GameObject that I move around with physics (AddForce). This object has an animator component attached to it. I select this object, open the Animation window, and create a new clip. I then add a new curve and select the child object's position.
    Now, if I don't adjust the child object's position at all, everything works fine. However, if I do adjust it, it causes the parent GameObject to "stutter" when moving (It starts and stops moving). If I enable "Apply Root Motion" the parent GameObject will slowly float upwards.

    I have no idea what is going on or how to fix this. Can anyone please give me some advice?

    EDIT: After testing a bit more, I found that this only seems to occur if the parent object uses rigidbody. I need rigidbody on my object though. Is there any way to make this work?

    EDIT: So apparently the issue is that for some reason, animations will overwrite the rigidbody calculations, even if you're only animating the position of a child object. I got around this by attaching the Animator to a child object of the rigidbody.
     
    Last edited: Apr 24, 2014