- Home /
Parent-child rigidbody issues with collider
Okay, I have a bike in air the scene, say Parent, and its various child objects like handle and wheels, Parent is a rigidbody, on Wheels(child) a wheelcollider is added. Rigidbody is added to wheel to make AddTorque function properly.Here come the issues
1) Without Rigidbody on the child, bike behaves as expected. 2)if rigidbody is added on child, the child will remain in air ( Parent is always rigidbody) 3) if gravity is checked, the child will keep falling through the terrain, although wheelcollider is added.
I need my bike to fall on terrain, with all its elements, and then move as i press the up arrow,
NOTE: I have to add rigidbody to child to make my script work, as AddTorque script works on rigidbody
not needed but here is my script
void Update () {
if(Input.GetKey("up")){
float v = Input.GetAxis("Vertical") * amount * Time.deltaTime;
GetComponent<Rigidbody>().AddTorque(transform.right * v);
}
if(Input.GetKey("down")){
float v = Input.GetAxis("Vertical") * amount * Time.deltaTime;
GetComponent<Rigidbody>().AddTorque(-transform.right * v);
}
You need a HingeJoint or any other joint to keep rigidbodies together. Parenting does not hold rigidbodies together like it does with objects that are not influenced by physics.
Answer by villevli · Aug 23, 2016 at 01:55 PM
You don't need a Rigidbody with WheelColliders. Only the root object of the vehicle has a rigidbody. The tutorial explains how wheelcolliders work.
this, i was looking for this exactly, Thank you, up you go
Your answer
Follow this Question
Related Questions
Character Controller Pushes Car With Wheel Colliders? 0 Answers
Collider/Rigidbody not working as expected 1 Answer
Add colliders without affecting rigidbody behaviour? 2 Answers
Make locomotive Pull Carriage 0 Answers
Collision Problem 1 Answer