Game Development Community

PhysX actor going out of synch

by David Caloguerea · in Torque 3D Professional · 07/30/2009 (1:48 pm) · 4 replies

Hi all

We want to have a physx player controlled object in our game, I made some coding and created a child of the PxSingleActor, and created applyImpulse from the processTick function.

I can control it without problems and seems to be colliding ok with the heightmap and physx objects, but after some collisions with physx objects I can see some offset between the model I see on screen and the physx actor.
It seems that the physx actor is getting behind after the collisions and the difference in their position grows bigger as I collide with more objects, which leads to some strage behaviors from my object (apparently trying to reach the physx actor's position and moving on its own).
I also seems that PxSingleActor::applyCorrection only adjustes speed, not position.

Is there any way to show the physx primitive for my object? Is this a known or an unknown bug?

Thanks in advance

David C
ACE Team

About the author

Recent Threads


#1
08/01/2009 (10:52 am)
This sounds interesting.

I've seen the two not line up before, but that started at or near object creation time, along with me trying some scripting stuff I probably shouldn't have expected to work in the first place. (My physXStream was probably buggy.) But yes, it did involve a PxSingleActor and a large applyImpulse soon after object creation time.

It was also misaligned by enough that it was very obvious in the PhysX SDK's Visual Remote Debugger.

(See my reply in my last post here: http://www.garagegames.com/community/forums/viewthread/97051)

Now that I am rethinking this problem, I may go back and play with it again.

Good luck,

Colin
#2
08/03/2009 (7:02 am)
I am thinking in changing a bit the PxSingleActor so it interpolates to the last known position from the PhysX engine, by keeping the client a tick after in time.

Some time ago I made a turn based game and I just simulated the physycs in the client which was playing and broadcasted the position of the objects to the other clients.

Since in the game I am prototyping doesn't require fast response to the controls (not a FPS), I was thinking of having everything show up a tick after it was simulated, this way I can have lastPos and nextPos and I can smoothly interpolate them.
Impulses will apply instantaneously to the PhysX engine, but will show up on screen a tick later, so I can avoid position synch problems while keeping it smooth.
#3
08/10/2009 (7:48 am)
The corrections happening in PxSingleActor are not really working. Most of the PhysX classes assume you're running in single player. The corrections we have in there are merely an attempt at correcting, and really aren't guaranteed in any way to keep things in sync. If you're trying to control an object and need it to be synched between client/server, you'll want to use something similar to the PxPlayer's PhysX character controller. Unfortunately, it was changed to assume singleplayer in a lot of cases in order to work with the breakable buildings and the PxMultiActor class in general.

However, before the singleplayer hacks were added, the PxPlayer controller worked correctly in the multiplayer case and would stay in sync. PhysX in general makes no attempts at syncing in networked cases, and it's an incredibly difficult problem to solve.

As far as I know, there are no plans to solve the network correction issue for the PhysX plugin (at least, I know I'm not planning on trying it again, the last time was a nightmare).
#4
08/12/2009 (10:30 pm)
Ross,
Good to know. Thank you for your reply.
Colin