Page 1 of 1

Teleporting and joints

Posted: Mon Apr 09, 2018 3:11 pm
by Thomato
Hi everyone,

first of all I thank you Norbo for making this great engine!

So, I have a spacecruiser entity and attached to it via RevoluteJoints some turrets. Everything works fine, like in the tank demo. Now for networking the simulation runs on multiple clients and the server sends authorative updates and the clients set the spacecrusiers entity.Position from time to time but not on the turrets. Interpolation happens only on the visuals and it works for the spacecruiser but the turrets seem to lag behind and interpolate til they reach the new goal position. Is there a way to make the turrets snap to the new position or is this the complete wrong way to do position correction?

Thanks in advance to anyone who can help!

Re: Teleporting and joints

Posted: Mon Apr 09, 2018 11:33 pm
by Norbo
Teleportation is not a physically 'understood' action- when only part of the ship is teleported, the other connected pieces stay where they are. The resulting constraint error is gradually fixed at the velocity level, as you've observed.

Generally, when applying network corrections, it's a good idea to teleport everything together. In other words, for every object which depends on the teleported object (like the turrets on the ship), compute their local state before the correction, then reconstruct their post-correction pose by transforming the local state by the new teleported state.

Doing this for translation and orientation can be pretty critical for maintaining good behavior. It can also be helpful to do the same for the velocities of dependent objects.