Hi, im my application, physics and sounds are perfectly synchronized, but graphics are a bit late (about 0.25 sec, more than one frame). I checked my physics simulation loop : I always call fetchResult() after simulate(), each time before using actor->GetPose(). I’m stuck for a week on this, and could’nt find anything solving it …
Thank you.
Delta time is the same for graphics and for physics, what’s more delta time in graphics is only used for texture and skinning animations.
For a single frame (game engine loop) :
-Get delta time
-Call the physics loop with delta time as argument. (simulate() and fetchResult() for each time step)
-Render the scene with the same delta time as argument, using actor->GetPose() to position dynamic entities.
I don’t know why, but with this scenario, I have a time shift between physics and graphics.
Because sounds are perfectly synced with physics. When there’s a collision, I hear the sound before the entities collide graphically. It’s even more noticable when I use huge velocities (racing game).
I think you should use visual debugger and see if the collision shape of your vehicle is matched with its graphical mesh or not.maybe the pivot point of them are not the same.
Thanks. I’ve already checked with PVD, the collision shapes match with the graphics mesh. And this latency is for any rigid body and for vehicles. For instance if I drop a box on a plane, I will ear the collision sound before the box touches the plane (graphically).
It’s like actor->getPose() is giving a previous pose from a constant time shift (around 0.25 sec), but obviously it must be something else …
It may sounds weird but you may accidentally run the physic for more than once in a frame.It happened to me before.You may want to add a counter to physic and your graphic and check if the number of calls are the same.