Download

Physics simulation custom execution problem.

Using the Advanced vehicle template, inside the actor vehicle I’ve written a function that call the Physics simulation 40 times for a particular frame.
So almost each tick I’m executing this function:



PxScene* PScene = GetWorld()->GetPhysicsScene()->GetPhysXScene(PST_Sync);

for (int32 a = 0; a < 40; ++a) {
	PScene->simulate(1.f / 60.f);
	PScene->fetchResults(true);
}


What I’m expecting is when this function is called the car should go a little bit further so as final result the car should be a little more speedy.

But the real result is this: https://youtu.be/1tfmbXuETRc where the physX simulation seems completelly broken.

What I think is that at the end of the cycle I should broadcast the event that render the scene because I think the problem is not in the physics simulation but in the syncronization with rendering phase.

Probably the problem is another (for example I must call “simulate” in another way) so I’ll be glad to ear your advices.

To make car go faster, increase its velocity.

Also, you can use substepping to increase accuracy.

No need to manually simulate multiple times per frame

You right on how to increment speed, But it’s not my purpose, it’s only what I’m expecting by code written above.

I’ve not written which’s the purpose of this “re-simulation” but probably I did wrong.

I need replicate the movement of a car from client to server. When the server send an adjustment I need reply back few moves.