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
- 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) - 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);
}