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

Null attachedRigidbody of a WheelCollider

$
0
0
Hi guys, I've got a weird (and posibly a bug) situation here. Currently, I am making a car prefab with a box and 4 cylinders as the wheels. This is the hierarchy: - Car Root (components: CarController, Player, BoxCollider, Rigidbody) - Body (component: BoxMesh) - Front Axle - FR Wheel (component: WheelCollider) - FR Wheel Model (component: Cylinder) - FL Wheel (component: WheelCollider) - FL Wheel Model (component: Cylinder) - Rear Axle - RR Wheel (component: WheelCollider) - RR Wheel Model (component: Cylinder) - RL Wheel (component: WheelCollider) - RL Wheel Model (component: Cylinder) It worked fine at first. And then I tried changing the model into the proper one from an fbx file. The hierarchy is still the same. But when one line in my CarController script wanted to access the rigidbody that is attached to the wheel (WheelCollider.attachedRigidbody), it throws a null error. When I commented this line, the error is gone but all 4 wheel models (and also the wheel) goes to the world position {0, 0, 0}. I didn't do anything else besides changing the model so this is odd. And also, isn't the attachedRigidbody set automatically from the WheelCollider's parent in the hierarchy? Can anybody help me solve this? 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>