Hi guys,
I have a parent object, like a ball, with another object as a child inside. I have it scripted such that when the parent ball collides, it unparents the child. No problem there. The problem is that I don’t want to child object to react to physics or gravity until it’s unparented. After it’s unparented, I want it to fall, bounce etc. I’ve tried setting isKinematic to true until the parent is detached, but there’s still mass in the child object and it goes flying on it’s own away from the parent. Is there a way to make the rigidbody null until the child is unparented, then add it back? And is this the best solution? Here’s the script I’m using now that isn’t working very well:
function Update () {
if (transform.parent == "ball")
{
transform.rigidbody.isKinematic = true;
}
else
{
transform.rigidbody.isKinematic = false;
}
}
I’ve attached this to the child object.
As always, thanks in advance for your help. :roll: