# Physics simulation custom execution problem.

**URL:** <https://forums.unrealengine.com/t/physics-simulation-custom-execution-problem/93769>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [June 5, 2017, 1:54pm UTC](https://forums.unrealengine.com/t/physics-simulation-custom-execution-problem/93769 "2017-06-05T13:54:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![B1TZ3R0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@B1TZ3R0](https://forums.unrealengine.com/u/B1TZ3R0)\
**Post date:** [June 5, 2017, 1:54pm UTC](https://forums.unrealengine.com/t/physics-simulation-custom-execution-problem/93769/1 "2017-06-05T13:54:50Z")

</div>

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:

```auto

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](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.

---

<div class="post-metadata">

**Author:** ![OptimisticMonkey](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/optimisticmonkey/32/906571_2.png) [@OptimisticMonkey](https://forums.unrealengine.com/u/OptimisticMonkey)\
**Post date:** [June 5, 2017, 2:52pm UTC](https://forums.unrealengine.com/t/physics-simulation-custom-execution-problem/93769/2 "2017-06-05T14:52:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![B1TZ3R0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@B1TZ3R0](https://forums.unrealengine.com/u/B1TZ3R0)\
**Post date:** [June 5, 2017, 3:25pm UTC](https://forums.unrealengine.com/t/physics-simulation-custom-execution-problem/93769/3 "2017-06-05T15:25:07Z")

</div>

> [@OptimisticMonkey;719768](#):
>
> 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.
