I have a script on my player to move. I do not have root motion applied because, root motion does not work perfectly so I'm manually adding velocity to the player.

The player is holding a ball and the ball is a child of the player. However, when I apply force to the player it seems to apply force to the ball so he stops holding it and it is just floating around instead.

My player and my ball both have rigidBodies and I'm applying force like this.

    var velocityX = horizontal * HorizontalSpeed * Time.deltaTime;
    var velocityZ = vertical * VerticalSpeed * Time.deltaTime;

    rigidBody.velocity = new Vector3(velocityX, 0f, velocityZ);

I know as a hack I can apply a late update to the ball, but I'd rather understand what is going on.

Can anyone help me figure this out?


When we parent a game object to another game object, we make the Transform values of the child object local to the Transform values of the parent object.

This is very useful, if used correctly. In the above situation, we have a character holding a ball. While we move the character with the assumption of still holding on to the ball, we can simply move the character. As it is local to the character, the ball moves with it. However, this does not work when we parent separate objects containing Rigidbody components. A Rigidbody interprets every child object as part of that Rigidbody, where a child Rigidbody can break this assumption, and lead to odd behaviour.

As detailed at Unity Answers, you should use joints to attach Rigidbody game objects.

  • \$\begingroup\$ Thanks is that somewhere in the documentation, can you provide a link. Also, do you know of a way to fix this or temporarily disable the rigid body component? \$\endgroup\$
    – johnny 5
    Feb 2 '17 at 2:19
  • \$\begingroup\$ Hey I tried adding a fixed joint but I'm having some issues. I've posted a new question if you have time to help me out I would be very grateful here is the link gamedev.stackexchange.com/questions/136785/… \$\endgroup\$
    – johnny 5
    Feb 3 '17 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.