I am trying to tap into my wheel colliders and make my car move but the code I have doesn't seem to be doing anything and it's all I can think of. Hopefully I am close but if I'm not I need some help. Thanks
if(moveCar) {
foreach (Transform child in theCar.transform)
{
if(child.name.Contains("wheels")) {
Transform wheels = child;
foreach (Transform childw in wheels.transform)
{
childw.GetComponent().motorTorque = 10000;
}
}
}
}
My car hierarchy is
Car
-wheels
-leftWheelFront
-leftWheelRear
-rightWheelFront
-rightWheelRear
The code seems to access them correctly but the movement doesn't happen.
Thanks
↧