I have a btRaycastVehicle vehicle that I'm pretty happy with (after much fiddling). My suspension stiffness is currently at 700. It runs well, but the suspension almost never compresses - it's like it isn't there. I'd like to make it softer. I get good results overall at about 250. The problem now is that when my vehicle lands from a jump or drives up an abrupt hill, the wheels partially sink into the ground before they recover. They don't get stuck, but the penetration is about a third of a wheel diameter deep and lasts for a noticeable fraction or two of a second.
Is there any way to mitigate this without increasing the stiffness to the point where the suspension is too stiff to compress at all?
I found one way to fix this: I made sure the chassis collision object reaches down to the point where the suspension is fully compressed + wheel radius, i.e. the chassis hits the ground and prevents the suspension from fully compressing. The problem with this is that when the suspension is fully compressed and the vehicle is "riding the chassis", its behavior is much worse than when it's riding its wheels. It's choppy, sometimes the front hits the ground and completely stops, etc.
I also figured I should be able to add an extra set of stiff wheels as backups for the existing wheels. I.e. if the regular wheels fully compress, the stiff backup wheels hit the ground. I didn't really get any meaningful results here, but I'm still experimenting.
Some approximate details about my setup:
- vehicle mass: 250
- wheel radius: 0.20
- suspension rest length = max suspension travel = 0.10
- suspension stiffness = 250
- suspension_damping_compression = 0.2 * 2.0 * btSqrt(base_wheel.suspension_stiffness)
- suspension_damping_relaxation = 0.5 * 2.0 * btSqrt(base_wheel.suspension_stiffness)Is it a problem that the rest length and max travel are equal?
I read the following in Kester's notes at http://bit.ly/tmC4nG
Bullet's suspension has one major drawback: when the spring is fully compressed, it cannot provide enough force to keep the vehicle's chassis off the ground. In a real vehicle, the spring will hit a bumper, keeping the wheel away from the chassis. To simulate this, we use a constraint.
A suspension constraint has two parts: the suspension limits, and the suspension force. The suspension force is responsible for the spring force applied by suspension, and the suspension limits stops the wheels penetrating the chassis, or flying off the vehicle. Although the suspension spring forces could be applied outside the constraint system, it is convenient to implement them as a constraint row, since we need the force applied by the suspension to calculate the wheel friction forces.
How do I add a constraint like this? I'm pretty new to Bullet. As far as I can see, the existing constraints all work on two rigid bodies, but the wheels of a raycast vehicle aren't rigid bodies.