Teleporting and joints

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Posts: 1
Joined: Mon Feb 26, 2018 1:33 am

Teleporting and joints

Post by Thomato » Mon Apr 09, 2018 3:11 pm

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!

Site Admin
Posts: 4736
Joined: Tue Jul 04, 2006 4:45 am

Re: Teleporting and joints

Post by Norbo » Mon Apr 09, 2018 11:33 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests