Unity-Technologies/EntityComponentSystemSamples

why 6. Use Cases/RaycastCar wheels can sink half into ground?

ggdagcheng opened this issue · 1 comments

why 6. Use Cases/RaycastCar wheels can sink half into ground?

TLDR The vehicle demo is an extremely simple simulation of vehicle drive, friction and suspension.

The vehicles wheels and suspension are simulated with raycasts (i.e. single line segment through the center of the wheel). This means that if a vehicle is rolling towards a slope the vehicle will not get pushed up until the wheel is largely embedded into the slope.
This could be mitigated by using a Collider cast instead of a Ray cast. This would query for a support surface using the shape of wheel rather than a single line segment. A Collider cast would mean the wheel would hit the slope sooner than with a raycast meaning the vehicle will not embed in the surface as much.

Another reason for the embedding is that the suspension forces are only applied vertical, pushing the vehicle up but not hindering its movement forward, as would happen in a real car. This means that the vehicle could travel forward bringing the wheels further into the slope. Using the surface normal from the cast query could be used to retard the vehicle speed reduce the interpenetration.

Wheel interpolation could be a factor in the surface interpenetration. Insufficient suspension forces could be another.

We are looking at moving to collider casts for this demo in the future.