0
\$\begingroup\$

I want to add a collider to a wheel so that it does not interfere with the suspension in any way but will allow the car to run into walls or other cars. The implementation of the wheel is as follows:

Raycast downwards a fixed distance from the wheel's position to see if you are touching the ground. Calculate "spring" (how much the suspension is coiled) and add an appropriate force to the Rigidbody. If there is a collider on the wheel though, then it will just hit the ground and the shocks will not be able to compress because the ground will not get closer to the Raycast origin.

I can't just disable collision between the ground and the wheels, because then if the car falls over its wheels will just fall through the ground. And that's bad because the Raycast would be in the ground.

I have spent the day trying to come up with a solution to this, but can't wrap my head around it. If it wasn't for games like Crossout doing this, I would say it is not possible.

Thanks!

\$\endgroup\$
  • \$\begingroup\$ Have you tried using a WheelCollider for this? They have a suspension model built-in. \$\endgroup\$ – DMGregory Feb 28 at 12:42
  • \$\begingroup\$ Yes, but a wheel collider is not actually a collider. If to cars collide, their wheels will clip into each other, and that is what I am trying to avoid. \$\endgroup\$ – Sprocket Creations Feb 28 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.