nphysics icon indicating copy to clipboard operation
nphysics copied to clipboard

Jitters when approximating wheels with convex cylinders

Open TheEdda opened this issue 7 years ago • 2 comments
trafficstars

Hi, I've been trying to create a little racing game using nphysics for physics. I have a central piece and four wheels I attach to it using constraints. What I'm doing now is that I compute ConvexHull of the wheel model and use it as a shape. But this creates a lot of jitters when the car is moving, because the shape isn't smooth and the car is colliding with the ground very often and is getting bumped out of it.

I wanted to ask if there is any better way to simulate this. I would like to avoid having to create wheels out of multiple pieces, but right now that is the only solution to model elasticity I can think of.

TheEdda avatar Nov 14 '18 13:11 TheEdda

If you issues is due to the non-smoothness of the wheels, one solution is to increase the accuracy of the polyhedral approximation of their shapes.

A better solution would be to use a Capsule or a Cylinder as shapes for the wheel colliders, but those two primitives are currently not supported by nphysics. (Adding support of cylinders would be quite difficult, but adding capsule should be straightforward).

sebcrozet avatar Nov 15 '18 10:11 sebcrozet

Yes, it's mostly about the non-smoothness. I'll look into the shapes if I have some time, but right now I'll probably just add more divisions to my cylinders and hope it's enough. Thanks.

TheEdda avatar Nov 15 '18 13:11 TheEdda