Attaching static meshes to crowd members
Last updated
Last updated
The technical owner of attachments to crowd members is the rendering team.
You can attach/unattach static meshes to crowd members (which is any character further away than the closest ~30) dynamically. This has a similar function to attaching things to skeletal meshes in regular Unreal, but is for rendering only.
Examples usages are for rendering guns attached to players' arms, or for rendering forcefields which can be spheres attached to a different socket on the player.
Each mesh that you want to use as an attachment needs to be in your level's skeletal crowd mesh store.
Add your static mesh to the Meshes array, specifying the socket name of the sockets you want this mesh to attach to.
Important: make sure your mesh has "Allow CPUAccess" set to true in the Details panel, or your game will crash in cooked builds.
The socket name is used for both the socket on the static mesh, and the socket on the skeletal mesh that you're attaching to.
For example, to attach the origin point of the static mesh mesh to the socket "socket_lHand" on the player, you leave the socket name as socket_lHand. But to attach a specific socket on the static mesh to "socket_lHand" on the player, you will need to name the socket in the static mesh to also be "socket_lHand".
If the specified socket doesn't exist in the skeletal mesh, it will attach to the root bone of the skeletal mesh.
You can scale the size of the mesh when it gets attached by adjusting the "Relative Scale" of the static mesh socket.
The mesh store is just the list of meshes that are possible to attach to a crowd member. To actually attach them, you need to use the Added Crowd Static Meshes
override array in the Character Asset Component
of your Morpheus Character.
Adding a mesh to this array in the defaults will cause the character to render with that attachment when in the crowd. You can update the attachments that the character has dynamically by modifying this array at runtime, then calling Reload Character
on the character asset component.
Any mesh you add to this array must have been added to the mesh store.
Attachments can use materials using the custom data parameters in the same way that the animated crowd can.
All meshes that can be used as attachments must be specified in the mesh store. This means you can't currently dynamically load new meshes at runtime (e.g. MML meshes) and add them as crowd attachments.
You cannot scale or alter meshes that are attachments at runtime in any way. This means that you can't change the size of the bubble dynamically. Instead, you need to provide every variation to your mesh that you need as an additional element in your mesh store array, pick from that list.
Don't know which mesh store your project uses? Find your roles asset in WorldSettings.
In the roles asset, find the "Pawn Lod Level Set" of the role you want to configure (usually Default).
In your pawn lod level set asset, expand the crowd lod level set you want to configure (usually lod 1) and open your crowd data asset.
This asset gives you your mesh store!