Capsules
M2UP's handling of the capsule component when using MML avatars.
Last updated
M2UP's handling of the capsule component when using MML avatars.
Last updated
M2UP's base character types include a capsule component, but the usage is not the same as you'd use in native Unreal, as every user can load their own MML avatar.
Each character loads in with the capsule component specified in the defaults for the pawn class that is spawned (specified in your character configuration). By default, when a player loads in a new MML avatar, the capsule component will resize to include the bounds of that avatar.
This new capsule size is replicated in the background and automatically applied to other characters your client sees. Note that this also applies an offset to the skeletal mesh that is being used so that the mesh is rendered at the correct height. You can access this data and change the behaviour with some functions in JM_CharacterBase:
GetCapsuleData
returns the capsule data that has been applied locally for the given character. It returns an FCapsuleData struct, which you need to access or modify with the UJM_CharacterCapsule
helper functions. You can set this (replicated) value yourself with SetCapsuleData
.
GetSkeletalMeshLocalTransform
returns the local transform to this actor's skeletal mesh. This is modified as a result of applying capsule data, but can be set manually with SetSkeletalMeshLocalTransform
. This data is also applied in the crowd.
UpdateCapsuleSizeFromAvatar
is the function that's called when characters load in a new avatar, and you can call manually.
OnCapsuleChanged
is a delegate that's fired when the capsule component changes size as a result of locally changing the size or receiving a changed size over the network.
By default, UpdateCapsuleSizeFromAvatar
is called whenever a character loads a new MML avatar, but if you'd rather keep the capsules all the same size or handle this logic yourself, you can disable this with the game.Capsule.MatchCustomMesh
LiveConfig.