- Home /
Rigidbody Inside Rigidbody
I have a Car that has the main Rigidbody on it and I would like the wheels of the car to have rigidbodies as well so they will collide with objects, Namely, the road object so when it hits the road it will run a function that will correct its rotation back to 0.
Context, Endless runner but cars with ramps. The car will flip and move freely off the ramps but when the wheels hit the road I want it to auto correct.
Hope this makes sense.
Answer by Defetysta · Nov 26, 2018 at 10:15 AM
As far as I know, you are not supposed to have multiple rigidbodies in parent-child relation, there should be only one rigidbody attached to the parent object, since rigidbodies in such a relation can cause some problems. Better solution would be using colliders on children, as stated above.
Answer by RLord321 · Nov 26, 2018 at 12:27 AM
You can use Colliders (BoxCollider, CircleCollider, etc) on the wheel objects and put a script on them to receive the OnCollisionEnter, OnCollisionStay, OnTriggerEnter, etc, etc. Every wheel could have this script attached to it so you'll know exactly which wheel collided with the object. No child Rigidbodies are needed in this case.
I hope this helps.
Your answer
![](https://koobas.hobune.stream/wayback/20220612182743im_/https://answers.unity.com/themes/thub/images/avi.jpg)