Hinge constraints and object transform issues

jamie01
Posts: 3
Joined: Tue Jan 31, 2012 12:23 am

Hinge constraints and object transform issues

Post by jamie01 »

Hi,

I have been wrestling with this for some time now, and after a lot of (sometimes rather slow!) positive progress with Bullet and getting some really nice results from it, I'm stuck.

The basic problem is this; I know you're not supposed to forcibly move dynamic objects with world transforms, but I am developing an authoritative server style networked game, so there comes a time where the physics calculations become out of sync and corrective movements are needed. At the moment, this is done by setting an object's world transform (in this case, a ray cast vehicle). This has worked cleanly enough, especially when interpolation is included between the current predicted client position, and received position from the server.

I have just finished adding some hinge constraints on the vehicle doors, which work really nicely when the vehicle is moved entirely through forces (with applyEngineForce() )

But when correction updates are introduced, the constraint solver really doesn't like it. Understandably, it takes a couple of steps for the door to actually move back to the position the vehicle has warped to, and it's noticeable even for very small translations.

My first solution was simply to apply the transform to the door object too, but this just snaps the door closed again and removes the effect the hinges have. Applying the old rotation back on the door also doesn't work because the door ends up inside the vehicle in some cases. I have also experimented with CFM and ERP, and the various options available in the constraint solver info struct.

Short of transmitting door location and rotation with every update from the server I don't really know how to find a way around this?

Any help would be greatly appreciated!