- Home /
How to un-parent and add rigidbody on collision?
Hello guys, I want to unparent a gameobject (In my case bump_front) from my car and would add a rigidbody-component. I want to write it in java language please help.
All in one, if my car-bumper collides with a gameobject it will fall of.
Sry for my bad english im from Germany :)
Answer by MrSoad · Nov 18, 2014 at 05:26 PM
You might be best having a rigidbody on the bumper from the start, with one on your car as well. If you do this then do not have one as a child of the other(this would give odd unwanted behaviour). Once both are setup like this then you fix them together with a joint, you can then set this joint to break at a certain force impact at which point your bumper will fall off. Look at this :
http://unity3d.com/learn/tutorials/modules/beginner/physics/joints
and this :
http://docs.unity3d.com/Manual/class-ConfigurableJoint.html
Hope this helps :)
Thank you it helps alot. I think its better than a script (o)/ yeah.
Your answer
Follow this Question
Related Questions
How to achieve realistic car damage ? 2 Answers
How to create a system of damage to a racing game 1 Answer
Perfect friction with WheelColliders 1 Answer
changing gravity for one object. 5 Answers