How do you make a physics object stay 'upright'?

I’ve tried various approaches to right, including locking, axis, etc. in the config, but I’ve had no luck.

So far the only ‘success’ I’ve had, has been to set the rotation of the body on each step, which is, obviously, extremely jerky, slow and terrible.

How can you (using C++) constrain a physics body so that it always remains ‘upright’?

…and just to be clear, by ‘upright’ I mean, absolutely zero angular rotation on the object. If it’s a box, it sits perfectly flat regardless of what other ‘normal’ physics boxes might smash into it.

Hi Shadowmint,

I’d look into playing with the Angular Dampening values. Also you could try and move the center of mass of your object lower so it isn’t so easy to tip over.

1 Like

Angular dampening seems to do nothing useful. I’ve jacked the value up and down to 1000 and 1.0 and it seems to have exactly the same effect; ie. none. The object still rotates, you just can’t manually apply angular rotation to it.

Is there some trick to this to make it actually dampen all rotation (ie. including gravity), not just manually applied rotation?

There’s also a SetMaxAngularVelocity on the FBodyInstance you could try. Using the COM nudge might be your best bet.