Quantcast
Channel: Questions in topic: "wheelcollider"
Viewing all articles
Browse latest Browse all 490

Driving my car programmatically

$
0
0
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

Viewing all articles
Browse latest Browse all 490

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>