This has been quite a couple of frustrating weeks trying to figure out this issue.
I have a static mesh as a root of a Pawn. I’m attempting to override the center of mass of the Pawn to match the origin of the actor’s static mesh. To do this, I’m calling these two lines at every call of Tick():
meshComp->SetCenterOfMass(GetActorLocation() - meshComp->GetBodyInstance()->GetCOMPosition());
meshComp->GetBodyInstance()->UpdateMassProperties();
Then, to test the update, I do the following later on in the Tick() function:
meshCOM = meshComp->GetBodyInstance()->GetCOMPosition();
meshLoc = GetActorLocation();
float temp = (meshCOM - meshLoc).Size();
The value of temp should be very close to 0.0. But it’s not. It’s like PhysX is completely ignoring my center of mass override call.
This should be absolutely simple, but has caused me an incredible amount of headache. For anyone who has worked with PhysX and it’s actions on static meshes, what can I do here? I’m absolutely stuck. Thank you in advance.