Modular Character And Physics

Hey everyone.

I’m working on a modular character system and I’ve got the following already worked out.

  • Modular Character Array on my character blueprint that I fill in for all the various pieces of the mesh. With the following info

  • Each part has a FGameplayTag that defines the ‘part group’.

  • Each part has the USkeletalMesh

  • Each part has a PartShapeName

  • When the character initializes(and when the client recieves a replicated update for the array of visibility flags for these parts), I was initially displaying the models using SetMasterPoseComponent. This was super quick and easy, but I went ahead and did another pass to actually merge them into a single skeletal mesh in accordance with the Modular Character documentation(only with compileable code)

To accommodate different physics, currently I have a big monolithic PhysicsAsset, with the shapes for all the different parts all mashed into one. As part of my character mesh merging, I also clone the PhysicsAsset at runtime and make a pass through the Bodies to cull out all the shapes based on whether the modular character part is visible(using the above PartShapeName of the part against the shape name). This will admittedly get unwieldy with all the parts in there.

This is pretty easy and works so far, but I’m looking for alternative suggestions. One of the reasons I have been focusing so far on doing modular physics within the context of a Physics Asset is that I wanted to try and come up with a solution that can preserve all the flexibility that comes with a physics asset, like constraints and dynamics and stuff, that attaching things externally via additional components or actors might lose, though I have admittedly not pursued that possibility yet. At this point, since I am already merging the visuals, I guess the only other possibility to try for handling the collision side of things would be to attach a UStaticMeshComponent with the physics pieces of the armor attached to bones/sockets. Are there any other possibilities here? Does anyone know whether static mesh based collision bodies would better or worse in any particular ways? Performance, access to any of the skeletal mesh dynamics of the parent character, etc.

Has anyone attached static mesh collision to skeletal meshes? Can you share your experience with that approach? Pros/Cons

Thanks

1 Like

Did you ever find an answer on this?

Each skm can have its own phat asset.
And respond accordingly.
This probably was not the case years ago.

Merging the phat assets is something I never came across. I somehow doubt the engine does it. However, they are primitive shapes so their cost is rather low.

Attaching static mesh collision to a skm can be done with sockets, and powered by the physical animation parameters to cause the limb to then respond based on object impact.

This is high cost in terms of perfomance.
Not many games do it. Particularly not since Chaos is a thing that still performs around 50% worse than physx.
It’s (or it was anyway) CPU compute bound, so consoles usually cannot afford it.