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

Object colliding with collider junction instead of sliding over it

$
0
0
Hi! I'm trying to make a train follow a rail, and I decided to do it with physics. My train has each whell as a separate object, and each of these has a capsule collider in the side of the wheel to prevent it from derailing. On the top of that, I have a wheel collider on another object put on every wheel, to keep it on the top of the rails, as seen in the pictures below. ![alt text][1] ![alt text][2] [1]: /storage/temp/196045-wheel-colider.png [2]: /storage/temp/196046-wheel-capsule-collider.png My rails on the other hand also have two colliders, one for every rail (on the same object). To move the trail I made a really simple script, where I basically apply a specific torque to the wheel colliders. private void FixedUpdate() { float torque = motorTorque * forwardInput; foreach(WheelCollider wheel in wheels) { wheel.motorTorque = torque; } Debug.Log(GetComponent().velocity); } Now, when the train starts moving, it does it great until reaching the end of each rail piece. In that moment it stops like it's crashed with a wall, unless the speed is enough to make the train go beyond the collision, but still colliding. This is showcased here: https://youtu.be/PMf2rV2KnH Any ideas of what is causing such behaviour or any ideas on how to solve it? 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>