# Get the transform of actors in each substep of physics simulation?

**URL:** <https://forums.unrealengine.com/t/get-the-transform-of-actors-in-each-substep-of-physics-simulation/1192610>\
**Category:** Programming & Scripting\
**Tags:** actor, unreal-engine, Physics, CPP\
**Created:** [June 8, 2023, 8:56am UTC](https://forums.unrealengine.com/t/get-the-transform-of-actors-in-each-substep-of-physics-simulation/1192610 "2023-06-08T08:56:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreM411](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AndreM411](https://forums.unrealengine.com/u/AndreM411)\
**Post date:** [June 8, 2023, 8:56am UTC](https://forums.unrealengine.com/t/get-the-transform-of-actors-in-each-substep-of-physics-simulation/1192610/1 "2023-06-08T08:56:00Z")

</div>

Is it possible to get the pose of an actor for every substep of the physics simulation in **Unreal Engine 5**?

**In Unreal Engine 4** , you can add a callback function to the `OnPhysScene[...]` delegates, e.g.:

```auto
primitiveComponent->GetBodyInstance()->GetPhysicsScene()->OnPhysScenePostTick.AddUFunction(this, "SubstepFunction");

```

or use the `FCalculateCustomPhysics` delegate, which was introduced by the following pull request: [https://github.com/EpicGames/UnrealEngine/pull/585](https://github.com/EpicGames/UnrealEngine/pull/585). Howevery, since Unreal Engine 5, these delegates are only called for every tick, not every substep anymore.

---

<div class="post-metadata">

**Author:** ![AndreM411](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AndreM411](https://forums.unrealengine.com/u/AndreM411)\
**Post date:** [June 8, 2023, 1:25pm UTC](https://forums.unrealengine.com/t/get-the-transform-of-actors-in-each-substep-of-physics-simulation/1192610/2 "2023-06-08T13:25:24Z")

</div>

If anyone has the same problem: I solved it using the `AsyncPhysicsTickActor` function.

I activated the tick by setting `bAsyncPhysicsTickEnabled = true;` in the constructor, then I overrode the function:

```auto
virtual void AsyncPhysicsTickActor(float DeltaTime, float SimTime) override;

```

and implemented it this way:

```auto
void AROS2Robot::AsyncPhysicsTickActor(float DeltaTime, float SimTime){
    UPrimitiveComponent* primComponent = static_cast<UPrimitiveComponent*>(GetRootComponent());

    if (primComponent != nullptr && primComponent->GetBodyInstance() != nullptr && primComponent->GetBodyInstance()->ActorHandle != nullptr) {
        Chaos::FRigidBodyHandle_Internal* Handle = primComponent->GetBodyInstance()->ActorHandle->GetPhysicsThreadAPI();
            
        // The transform of the actor with substepping precision:
        FTransform worldPos = Chaos::FParticleUtilitiesGT::GetCoMWorldTransform(Handle);
    }
}

```
