Currently getting it from FBodyInstanceAsyncPhysicsTickHandle::GetX().
Gives me this: LogOutputDevice: Error: Ensure condition failed: IsInGameThreadContext()
Currently getting it from FBodyInstanceAsyncPhysicsTickHandle::GetX().
Gives me this: LogOutputDevice: Error: Ensure condition failed: IsInGameThreadContext()
Do you have a solution? I’ve encountered the same problem
Chaos::FRigidBodyHandle_Internal* GetInternalHandle(UPrimitiveComponent* Component, FName BoneName)
{
if (IsValid(Component))
{
if (const FBodyInstance* BodyInstance = Component->GetBodyInstance(BoneName))
{
if (const auto Handle = BodyInstance->ActorHandle)
{
if (Chaos::FRigidBodyHandle_Internal* RigidHandle = Handle->GetPhysicsThreadAPI())
{
return RigidHandle;
}
}
}
}
return nullptr;
}
And then
FTransform GetTransform_APT(UPrimitiveComponent* Component)
{
if (const Chaos::FRigidBodyHandle_Internal* RigidHandle = GetInternalHandle(Component))
{
const Chaos::FRigidTransform3 WorldCOM = Chaos::FParticleUtilitiesGT::GetActorWorldTransform(RigidHandle);
return WorldCOM;
}
return Component ? Component->GetComponentTransform() : FTransform();
}