Any way to gracefully detach object with Unity physics?

Hi, I’m having an issue where I have a Rigidbody attached to a parent, and then I want to unparent it and add force.

First I tried having a kinematic rigidbody when it’s being held that is turned into a kinematic rigidbody when it is thrown. But when it is marked as kinematic the physics go WILD, even if I ignore collisions between the player and the projectile and set the velocity manually to 0 and even without adding any force.

The same thing happens if I use constraints instead of kinematic. When I remove the constraints (when it’s time to throw the object), the projectile goes crazy and launches all over the map, even if I don’t add any force to it.

Does anyone have any idea why this would be the case and what is the best way to “throw” a Rigidbody that was formerly attached to another one?

Make sure it is set to kinematic when parented to the other object. I’ve found objects seem to build up any forces acted on them only to release them all when they are unconstrained.

You have 2 solutions

  1. When you attach child, destroy Rigidbody component. When Detach add it again.
  2. Add fixed joint to child and set parent as connected body