[SOLVED] Vehicle Control On Dynamic Surfaces

Hello Guys,
I’m using jeyFella’s advanced vehicles lib. (thanks! great job) in my product and trying to use the vehicles on dynamic (moving) surfaces (see attached movie).
The problem is that when driving on static (not moving) Box everything is fine, working as expected but when moving to a dynamic Box the car is not stable up to the point of falling/diving into the Box and out of the scene (as seen in the sample clip).
I’m using regular Boxes but it also happens when using Lemure’s MBox with many splits (e.g. 100).
I suspect it has something to do with the wheel’s ray casting but i’m not sure at all…
Any ideas?
Thanks a lot!

Try increasing the max load on the suspension to something like 20,000 and see if it still exhibits the same behavior. I noticed just before it fell the suspension bottomed out. Usually things like this are suspension-related.

Off the top of my head:

for (int i = 0; i < vehicle.getNumWheels(); i++) {
    Wheel wheel = vehicle.getWheel(i);


How are you moving your boxes? Are they kinematic bodies?

…are you remembering to set their velocity?

Thanks! I will try it and report

The boxes are not kinematic objects. I move the RigidBodyControl.
I didn’t set the velocity. Should I?

Move it how? By warping? What’s the mass of the body?

If they are 0 mass objects and you want to move them then they should be kinematic and you should set the velocity when you move them or they will cause strange things to happen. Kinematic objects that are moved won’t impart any velocity on the objects sitting on them unless the velocity of the kinematic object is set.

Move them by setting the location of the RigidBodyControl. The mass is zero but I do not mark them as kinematic because if I do, then the car cannot use these Boxes as roads (it just falls through them).
So If I understand correctly, I should mark them as Kinematic=true and set the velocity? Then the car will be able to sit on them?

The car shouldn’t fall through kinematic objects. Not sure why that is happening so maybe there is some other issue.

I checked again. When I change my code to: setKinematic(true), objects (not just vehicles) are passing through it. This is my code:

CollisionShape modelShape =
        RigidBodyControl modelCtl = new RigidBodyControl(modelShape,mass);

mass = 1

I cannot find “setMaxLoad” neither in the wheel nor VehicleWheel nor the suspension. Maybe it is called something else?

1 Like

Kinematic objects have no mass. Mass is for real rigid bodies that will fall, deflect, etc… not moving static objects.

With a mass != 0, your object wasn’t even static before. I’m not sure what was keeping it from falling actually.

This is the dangerous part of us diagnosing problems for code that we can’t see. I suggest that you put together a simple one-class example of your issue. Else you will get a lot of random unhelpful guesses.

OK, I’ll do that and post the source code. Thanks!

I think that was meant to be PhysicsVehicle.setMaxSuspensionForce(float).

Thanks. Currently I was able to stabilize things making it work by adding more suspension length + more stiffness + moving the cube a little slower.
setMaxSuspensionForce by itself was not sufficient.
@sgold BTW thank you so much for the SkyControl lib. I started using it today and I really like it

1 Like