Merge pull request 'FIX - Delegate could be in header only' (#52) from fix-physic-post-step-delegate into main

Reviewed-on: #52
This commit is contained in:
Jean-Baptiste Briant (JB) 2025-04-30 14:43:26 +00:00
commit 507fb88756
2 changed files with 6 additions and 10 deletions

View File

@ -109,13 +109,6 @@ template <typename ComponentType> void AMujocoVolumeActor::AssignComponentsToArr
} }
} }
template <typename UserClass>
void AMujocoVolumeActor::BindPostPhysicDelegate(UserClass* Object, void(UserClass::* Func)(float))
{
PostPhysicUpdateDelegate.BindUObject(Object, Func);
}
void AMujocoVolumeActor::InitializeMujoco() void AMujocoVolumeActor::InitializeMujoco()
{ {
InitializeMujocoScene_WithContactExclusion(TMap<FString, FString>{}); InitializeMujocoScene_WithContactExclusion(TMap<FString, FString>{});
@ -417,7 +410,7 @@ void AMujocoVolumeActor::Tick(float DeltaTime)
for (int32 SimStep = 0; SimStep < SimStepsPerGameFrame; ++SimStep) for (int32 SimStep = 0; SimStep < SimStepsPerGameFrame; ++SimStep)
{ {
mj_step(MujocoModel.Get(), MujocoData.Get()); mj_step(MujocoModel.Get(), MujocoData.Get());
PostPhysicUpdateDelegate.ExecuteIfBound(MujocoData->time); PostPhysicStepDelegate.ExecuteIfBound(MujocoData->time);
} }
for (int32 i = 1; i < BodyComponents.Num(); ++i) for (int32 i = 1; i < BodyComponents.Num(); ++i)

View File

@ -114,7 +114,7 @@ public:
// ------- POST UPDATE ------- // ------- POST UPDATE -------
// --------------------------- // ---------------------------
private: private:
FPostPhysicUpdate PostPhysicUpdateDelegate; FPostPhysicUpdate PostPhysicStepDelegate;
public: public:
/** /**
* Register a delegate to be executed after mj_step, useful to fine control actuators * Register a delegate to be executed after mj_step, useful to fine control actuators
@ -122,7 +122,10 @@ public:
* @param Func - The Function to call - takes a float as parameter which is the current simulation timestamp * @param Func - The Function to call - takes a float as parameter which is the current simulation timestamp
*/ */
template<typename UserClass> template<typename UserClass>
void BindPostPhysicDelegate(UserClass* Object, void (UserClass::*Func)(float)); void BindPostPhysicStepDelegate(UserClass* Object, void (UserClass::*Func)(float))
{
PostPhysicStepDelegate.BindUObject(Object, Func);
}
// ------------------------- // -------------------------