LogoLogo
API Status
  • 👋Welcome
  • 🌐What is Morpheus Platform?
    • Interoperability
  • â„šī¸Help
    • 📗Glossary
    • 🆘Support
    • Firewall problems
    • EULA
  • CREATION
    • 🎮Unreal Development
      • ⚡Get Started
        • âš’ī¸Download the Editor
        • âĢUpload Content
        • 🌎Creating your own map
        • 📝Morpheus Base Project
        • ❓Differences from Unreal
          • 🧍Character Configuration
        • 📡Morpheus Networking
          • Introduction to Morpheus Networking
          • Network Levels
          • Replicated Properties
          • RPCs
          • Morpheus Render Targets
          • Morpheus Array
          • Networking FAQ
          • Replicating Sublevels
      • 📚Features & Guides
        • 📒Example Plugin
          • Nameplates
          • In-game roles
          • Resizing
        • 🏊Actor Pooling
        • 🔊Audio
        • 🎭Avatars
          • Creating an Avatar
          • Attachments
            • MML Attachments
          • Custom Animation Variables
          • Importing an NFT collection
          • Capsules and Mesh Transforms
        • 🤖Bots
        • đŸŽ™ī¸Chat
          • Unreal Text Chat
        • đŸŽ›ī¸Control Panels
          • Control Panel Configuration
          • DJ booth mission control
          • Observer Controls
        • 🔉Crowd Audio
        • đŸ¤ŧCrowd Rendering
          • Legacy Animated Crowd
            • Animated Crowd Console Commands
            • Attaching static meshes to crowd members
          • Crowd Materials
          • Performance Parameters
          • Live Config Settings
          • Crowd Animation
            • Crowd Anim Blueprint
              • User Guide - Crowd Anim Blueprint
              • Reference Guide - ABP Nodes
                • Animation Playback
                • States and State Machines
                • Variables
                • Transitions
                • Special
                • Blends
                • Additional Notes
        • 🍱Helpers & Extras
          • "Instanced Objects" in Blueprints
          • Objects with "world context"
          • Making DataAsset classes
          • Duplicate Objects
          • The Bootflow Subsystem
          • The "Wait For Condition" System
          • Advanced Graphics settings
          • Listening to inputs on UObjects
          • Morpheus UserID
          • World Services
          • M2Extras: Skins System
        • đŸ–Ĩī¸Loading Screen
        • ⚡Live Config
          • Editing for a World
          • Editing Locally
          • Default Settings
          • Accessing via Blueprint
          • Adding New Settings
          • Overriding Defaults
          • Using Arrays
        • 🧊MML
        • đŸ•ēMotion Capture
        • 📡Networking
        • đŸ“ĸNotifications
        • Raycastable Crowd
        • 🌐Singletons
        • 📱Streaming & Multiplatform
          • GFN on mobile
        • đŸ–Ĩī¸UI
          • "UI Mode"
        • đŸ—ƒī¸User Collections
          • Creating a New Object Definition
          • Accessing from Unreal
            • Creating Objects Definitions
            • Transfer Objects
            • User Collection Views
            • Receiving Updates
        • đŸ“ēVideo Players
          • Embedded Video Player
          • Millicast video streaming
            • How to Setup an In-Game Video Stream
            • Picture-in-Picture mode
          • Streaming Video Player
            • How to Setup a URL Video Player
            • Picture-in-Picture mode
        • 🐞Visual Debugging
          • Inspector
        • đŸĒŸWeb UI
        • Online Services
          • KV Store Service
        • 💠Web Requests
          • Http Requests
            • Legacy HTTP Nodes
          • JSON Handling
          • WebSockets
          • Identity Validation
          • Allowed External URLs
          • Walkthrough Example
            • Example Counter Service
        • âœˆī¸World Travel
          • World Travel in the editor
        • Avatar Physics Assets
        • Action Gameplay Helper Components
      • 🔑Workflows
        • â†—ī¸Upgrade the Editor
          • đŸ–Ĩī¸Version History
        • âš™ī¸Editing Project Settings
        • 📈Profiling
        • đŸ§ēMarketplace Importing
        • đŸ› ī¸Extra Workflows
          • Setup Play-in-Editor
          • Setup Local Asset Validation
          • Adding Gameplay Tags
          • Validating Game Assets
          • Custom Connection Modes
          • Connect Editor to a World
          • Common Issues
      • 📚Useful Reading
        • ⭐Best Practices
    • 🌎Worlds
      • 📩Invite Players
        • Setting Role Groups
      • Persistent Worlds
      • Always on Worlds
    • 📅Running events
      • ✅Large scale events - Checklist
      • 👾Anti-Cheat (EAC)
      • 🎮Player Entry
        • 📱React Native
        • Steam
        • đŸ’ģHardware Reqs
      • đŸŽĨBroadcast
        • 📹OBS Integration
      • Failover
      • 🏁Capacity And Queue Management
  • ADMINS
    • đŸ‘ĒAccess Control
      • Adding metaverse contributors
      • Creating a new project
    • 💲Pricing
      • Development Support
      • Included Usage & Overages
      • Cloud Streaming
      • Access Modes
      • War Room Support
      • Platform SLA
    • âš™ī¸Settings
      • đŸ—ƒī¸Projects
  • APIs and Tooling
    • đŸ–Ĩī¸API Reference
      • Accounts
      • Events
      • Key/Value Store
      • Organizations
      • Realtime
      • User Profile
      • World Builder
      • Worlds
    • đŸ’ģTemplate Web App
      • đŸ’ĸModeration
    • Pixel Streaming
    • 🚀Launcher
  • Integrations
    • 📊Analytics
      • Sending events from web
      • 🎮Sending Events from Unreal
    • đŸ’ŦChat
      • 🎮Integrating Pubnub with your Unreal Project
      • Adding Moderation to Chat
Powered by GitBook
On this page
  • Overview
  • Quickstart
  • Configuring the AvatarPhysicsAssetComponent
  • Configuring the Avatar Physics Asset Data
  • Testing the Avatar Physics Asset Component
  • Customising your Avatar Shape Rules
  • Skeleton Bounds Avatar Shape Rule
  • Creating a custom rule

Was this helpful?

  1. CREATION
  2. Unreal Development
  3. Features & Guides

Avatar Physics Assets

Assigning and replicating physics assets used on characters with an MML avatar.

PreviousWorld Travel in the editorNextAction Gameplay Helper Components

Last updated 3 months ago

Was this helpful?

Overview

The Morpheus Platform primarily uses for its characters, which allows players to bring in their own custom avatar. The mesh data for this avatar is streamed in to every observing client for rendering, but this does not include physics data, which means that each player will not see a physics asset on any remote player's character.

The Avatar Physics Asset component allows you to configure which physics asset should be assigned to remote characters based on their avatar. You can assign a global physics asset to be used for all characters, configure your game to only use capsule components, or assign different physics assets depending on the shape of the character's avatar.

Quickstart

Configuring the AvatarPhysicsAssetComponent

Create an AvatarPhysicsAssetComponent by creating a child class of M2M_AvatarPhysicsAssetComponent .

The important fields are:

  • Avatar Physics Asset Data: This configures which physics asset the character should use on remote clients. This is covered in the next section.

  • Interaction Query/Collision Channel: These are the channels that are dynamically enabled/disabled (by being set to ignore or block) by this component according to your configuration, to be used for your gameplay line tracing and collision. For example, these channels will be enabled and disabled on your character's Capsule according the configurations in this component.

Add this component to your Morpheus Character.

Configuring the Avatar Physics Asset Data

The Avatar Physics Asset Data controls which physics asset each character should be assigned on remote clients according to the avatar that character is currently using. Create an AvatarPhysicsAssetData (a Data Asset) by creating a child Data Asset of M2_AvatarPhysicsAssetData.

M2UP comes with some example AvatarPhysicsAssetData assets for you to get started with right away, instead of creating your own:

  • DA_M2_HumanoidIfApplicable_PhysicsAssetData : Assigns the character a humanoid physics asset if and only if the character's avatar is roughly humanoid shaped.

  • DA_M2_AlwaysHumanoid_PhysicsAssetData : Always assigns the character a humanoid physics asset.

  • DA_M2_EmptyPhysicsAssetData : Never assign a physics asset to the character. By default, this will enable the Interactable channels for your character's Capsule component.

Add an element into the Avatar Physics Asset Infos array.

  • Ingame Physics Asset: The physics asset to assign this character if the character's avatar matches the Avatar Shape Rule.

  • Avatar Shape Rule: An asset representing a function that takes an avatar mesh as input and returns true or false, depending on whether the avatar matches this rule. Information on creating your own custom rule from scratch, or from customising M2UP's skeleton bounds rule is covered below. You can also use the example rules contained in M2UP: BP_M2_AlwaysValidAvatarShapeRule and BP_M2_IsHumanoidAvatarShapeRule . The latter should only match avatars which are approximately humanoid in shape.

As an example, if I want my character to be assigned PHYS_UE5Mannequin whenever their avatar matches the BP_M2_IsHumanoidAvatarShapeRule (i.e. when the avatar is approximately humanoid shaped and sized), the Physics Asset Info should look like this.

You can add multiple entries to the Avatar Physics Asset Infos array to match different physics assets to different characters depending on their avatar. In the case that multiple rules match an avatar, the first entry in the array that matches will be used.

To get the best performance out of high scale games, use a maximum of one entry in this array.

If a character uses an avatar that doesn't match any of the Avatar Physics Asset Infos, the function M2M_AvatarPhysicsAssetComponent.HandleInvalidPhysicsAsset is invoked. By default, this enables the Capsule component to block the Interactable channels, but can be overridden.

Testing the Avatar Physics Asset Component

You can use the Unreal show collision command to view the physics assets in use. Your local player uses your mesh's generated physics asset, so to see the effects of the Avatar Physics Asset Component, start a PIE session with 2 clients. You should see that for each client, the remote character has been assigned a physics asset according to the rules.

Customising your Avatar Shape Rules

M2 has a pre-configured SkelBoundsAvatarShapeRule that determines if an avatar fits between bounds which you can configure. Alternatively, you can write your own rule that derives from UM2_AvatarShapeRuleBase .

Skeleton Bounds Avatar Shape Rule

The UM2_SkelBoundsAvatarShapeRule is a rule that determines whether an avatar is between the bounds of two assets, with certain tolerances. This can be used to determine if an avatar is appropriate for a given physics asset.

For example, this is the the BP_M2_IsHumanoidAvatarShapeRule that extends UM2_SkelBoundsAvatarShapeRule .

  • Max/Min Physics Asset: The auto-generated physics asset for the user's mesh should be mostly within these bounds.

  • Reference Anim: This is the animation that will be used on the user's mesh to determine if the mesh is within bounds. This should be a neutral animation pose, like a T pose.

  • Voxel Edge Length: The comparison works by dividing the volume of the player's mesh into voxels and counting the number of voxels that are in or out of the bounds. This field determines how big these voxels are. Small voxels gives more accuracy but worse performance.

  • Required Min Coverage: The fraction of the minimum physics asset that must be covered by the user's mesh. Set to a higher value to be less tolerant of user mesh being smaller or not covering certain parts of the min physics asset.

  • Max Allowed Out Of Bounds: The fraction of the user's mesh that is allowed to be outside the max physics asset bounds. Set this to a lower number to be less tolerant of a user mesh being too large in parts compared to the max physics asset.

  • Debug Draw Voxels: Draw the voxels used for comparison, with voxels coloured according to if they are in or outside the bounds.

  • Debug Draw Collision Elements: Draw the comparison physics assets alongside the mesh's auto generated physics assets.

Alongside the Debug Draw settings, this rule will output in the LogM2AvatarPhysicsAsset category to give additional information about why the rule did or did not match an avatar.

You can also access metadata about the result of the avatar rule matching on the local client (whether the avatars were too big, small, or a different error) in the UM2M_AvatarPhysicsAssetComponent.LocalAvatarShapeRuleResults property.

Creating a custom rule

You can also create your own custom Avatar Shape Rule. Create a child class that extends M2 Avatar Shape Rule Base and override Does Avatar Shape Meet Rule .

Here, you can write custom logic to determine if the input avatar skeleton should match the rule. The struct that is returned should contain IsValid=true if this avatar did match the rule; the other properties are for observability purposes only.

Approximate Skeletal Mesh (Used only in the ). The Skeletal Mesh asset that the actor will use to represent this character, when this character is part of the crowd and its avatar matches this entry's rule. This should be a Skeletal Mesh asset that appropriately matches the Ingame Physics Asset.

However, using multiple avatar physics assets will limit the scale of your game, as there is currently a performance cost associated with swapping physics assets in

The capsule component on M2 characters automatically resizes to match the mesh by default. More info on this can be found .

🎮
📚
Crowd
Raycastable Crowd
pooled character actors.
here
MML
avatars
I expect characters matching this rule to be approximately the same shape and size as SK_UE5Mannequin, so that's what I've specified for the Approximate Skeletal Mesh to be used by my Raycastable Crowd.
In this example, the characters are using the DA_M2_HumanoidIfApplicable_PhysicsAssetData physics data, which matches the humanoid robot avatar but not the big blobby avatar. We can see that from Blobby's client, the robot has a humanoid physics avatar, and from the robot's client, Blobby has not been assigned any physics avatar. Note that characters with invalid avatars may still sometimes appear with a physics avatar due to character pooling - this normally causes no issues as line queries are blocked by the enclosing capsule, but you can enable Unassign Physics Asset on Invalid Avatar to change this behaviour.
Red voxels indicate areas where the user mesh exceed the max bounds, which according to the output log is 83% of the input match, so this does not match the rule that only has a 23% tolerance for Max Allowed Out Of Bounds.