I’ve been attempting to make various runtime modifications to the ragdoll of a skeletal mesh. Initially I thought I would do this via somehow modifying the Bodies
and Constraints
of the SkeletalMeshComponent
arrays, filling them in myself in a similar fashion to how they are filled in from the PhysicsAsset
using InstantiatePhysicsAsset_Internal
.
But this seems quite problematic - the PhysicsAsset
is used all over, and there are various checks like ensureMsgf(PhysicsAsset->SkeletalBodySetups.Num() == Bodies.Num(), TEXT("Mesh (%s) has PhysicsAsset(%s), and BodySetup(%d) and Bodies(%d) don't match")
.
So while the name PhysicsAsset
would suggest its intended use is to be a editor time object that should only be used for an initial instantiation of the bodies and constraints, that doesn’t seem to be the case.
Are there any plans on changing this, e.g. creating some sort of API for runtime modification of the bodies/constraints, or refactoring the PhysicsAsset
into an actual editor-only object and a runtime “PhysicsSetup” object, or something like that?
I’d appreciate any feedback on how runtime ragdoll modification should be done. So far, it seems like I might just have to create my own empty PhysicsAsset
s, fill them in at runtime, and then assign them to the skeletal mesh when I want to change the ragdoll of the skeletal mesh.