diff --git a/Content/Blueprint/Mujoco/BP_MujocoSettingsStretchV1.uasset b/Content/Blueprint/Mujoco/BP_MujocoSettingsStretchV1.uasset index 6b658a08..82ba9caf 100644 Binary files a/Content/Blueprint/Mujoco/BP_MujocoSettingsStretchV1.uasset and b/Content/Blueprint/Mujoco/BP_MujocoSettingsStretchV1.uasset differ diff --git a/Content/Developers/Wdev/Robots/BP_Stretch.uasset b/Content/Developers/Wdev/Robots/BP_Stretch.uasset index f42564c1..32c68564 100644 Binary files a/Content/Developers/Wdev/Robots/BP_Stretch.uasset and b/Content/Developers/Wdev/Robots/BP_Stretch.uasset differ diff --git a/Content/Map/EmptyTestLevel.umap b/Content/Map/EmptyTestLevel.umap index 71f1d32a..701c3d65 100644 Binary files a/Content/Map/EmptyTestLevel.umap and b/Content/Map/EmptyTestLevel.umap differ diff --git a/Plugins/LuckyMujoco/Source/LuckyMujoco/Private/Actors/MujocoVolumeActor.cpp b/Plugins/LuckyMujoco/Source/LuckyMujoco/Private/Actors/MujocoVolumeActor.cpp index ac44a678..0e0bdddc 100644 --- a/Plugins/LuckyMujoco/Source/LuckyMujoco/Private/Actors/MujocoVolumeActor.cpp +++ b/Plugins/LuckyMujoco/Source/LuckyMujoco/Private/Actors/MujocoVolumeActor.cpp @@ -11,6 +11,7 @@ #include "LuckyMujoco.h" #include "fstream" #include "filesystem" +#include "Kismet/KismetMathLibrary.h" AMujocoVolumeActor::AMujocoVolumeActor() { @@ -387,16 +388,26 @@ void AMujocoVolumeActor::PostRegisterAllComponents() } } -void AMujocoVolumeActor::Tick(float DeltaTime) +void AMujocoVolumeActor::Tick(float DeltaTime) { if (MujocoData) { - mj_step(MujocoModel.Get(), MujocoData.Get()); - - for (int32 Frame = 0; Frame < FrameSkip; ++Frame) - { - mj_step(MujocoModel.Get(), MujocoData.Get()); - } + // const int32 FixedSteps = UKismetMathLibrary::SafeDivide(DeltaTime, Options->Options.TimeStep); + // + // if (FixedSteps > 0) + // { + // for (int x = 0; x < FixedSteps; ++x) + // { + // mj_step(MujocoModel.Get(), MujocoData.Get()); + // } + // } + + //mj_step(MujocoModel.Get(), MujocoData.Get()); + //mj_forward(MujocoModel.Get(), MujocoData.Get()); + for (int32 Frame = 0; Frame <= FrameSkip; ++Frame) + { + mj_step(MujocoModel.Get(), MujocoData.Get()); + } for (int32 i = 1; i < BodyComponents.Num(); ++i) { @@ -405,7 +416,7 @@ void AMujocoVolumeActor::Tick(float DeltaTime) mjtNum* Pos = MujocoData->xpos + 3 * i; mjtNum* Quat = MujocoData->xquat + 4 * i; - FVector Position = FVector(Pos[0], -Pos[1], Pos[2]) * 100.0f; + FVector Position = FVector(Pos[0], -Pos[1], Pos[2]) * 100.f; FQuat Rotation = FQuat(Quat[1], -Quat[2], Quat[3], -Quat[0]); BodyComponents[i]->SetWorldLocationAndRotation(Position, Rotation); diff --git a/Plugins/LuckyMujoco/Source/LuckyMujoco/Public/Actors/MujocoVolumeActor.h b/Plugins/LuckyMujoco/Source/LuckyMujoco/Public/Actors/MujocoVolumeActor.h index cd9737eb..80e0c72f 100644 --- a/Plugins/LuckyMujoco/Source/LuckyMujoco/Public/Actors/MujocoVolumeActor.h +++ b/Plugins/LuckyMujoco/Source/LuckyMujoco/Public/Actors/MujocoVolumeActor.h @@ -106,13 +106,18 @@ public: UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Mujoco") double GetJointValueByIndex(int32 JointIndex) const; - + + + + ///////// ********************************************* virtual void PostRegisterAllComponents() override; virtual void Tick(float DeltaTime) override; virtual void PostInitializeComponents() override; + //////&&&&&&&&&&&&&&&&&&&& + protected: virtual void BeginPlay() override;