I am using a VehicleControl, adding the player model to it, and then adding the wheels.
However I have a problem. When turning, especially at high speeds, the vehicle flips over very easily.
How can I make the vehicle more stable, so that it does not flip over? Something like a angle limitation would be great (but I can’t get this to work because rotation is in quaternions and I have to convert it to vehicle rotation and other garbage), but I would really prefer to stop jBullet from trying to flip the car over in the first place.
TL;DR - How do I stop a VehicleControl from flipping over so easily when turning?
I think this is the expected behaviour for a really heavy tank running as fast as a racing car.
I may be wrong, but my guess is, since the mass is the resistance of a change of motion, when you turn the tank since the mass is high it tries to keep it’s motion (and roll because the friction of the wheels?).
Makes the vehicle very slippy and hard to control - However it is impossible to flip over (perhaps your friction idea was right?).
Increasing the mass or gravity doesn’t seem to do anything… Which seems odd to me. And increasing suspension stiffness just results in buggy behaviour.
The center of mass is the center of the collision shape. Make a compound shape, add the collision shape for the car hull with an up offset, attach the model to a node with the same offset and then add the compound shape to the node. This way the center of mass will be at the node, below the actual model and collision shape.
That’s just JMETest’s TestPhysicsCar. I don’t understand how that is going to help me stop my car flipping over? Especially as most of my existing code is practically copied from there anyway and so is almost identical.
Edit: If anything, the car in TestPhysicsCar flips over EVEN MORE than my one!!
I know what I posted, yes. You asked me a specific question, I gave an answer and then you wanted example code for what I said. Look at line 102 in the file I posted.