SetSimulatePhysics and bWeld

When i call SetSimulatePhysics on RootComponent PrimitiveComponent->BodyInstance.bWeld Do not become “true”. And this creates problems when I want to call PrimitiveComponent->UnWeldFromParent() this function just not worked. This is necessary when we turn off the simulation on RootComponent(SetSimulatePhysics(false)), and all children Stay with non-valid bodies!

Hi anadre,

Sorry for the delayed response. Are you still having trouble with this? Would you be able to provide a sample class where you are setting this up?

Yes, I used Code snippet from function PrimitiveComponent->UnWeldFromParent() But without verification bWelded.

But I think that there should be a simple way to return valid bodies to the child components

Hi anadre,

I apologize, I lost track of this post. I wasn’t able to find a bWeld property on BodyInstance. Were you referring to bAutoWeld?

He presumably means bWelded, which appears in the generated API documentation here (FBodyInstance | Unreal Engine Documentation) and presumably exists at compile time since OP could compile while referencing it, but it doesn’t appear anywhere in BodyInstance.h so I have no idea where it’s coming from. (It was either removed at some point and the documentation parser is acting up, or it’s somehow being added externally by PhysX magic?)

There’s a function IsWelded() on UPrimitiveComponent which checks the validity of the FBodyInstance’s WeldParent pointer. I’m using that and it’s working okay and should solve OP’s problem.

That does make more sense than what I was seeing in the source code for the class itself. The bWelded variable was removed from the class not too long ago. I have put in a ticket to see if we can get the documentation for the FBodyInstance class updated.