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 Raycastable Crowd Actor class
  • Configuring the Raycastable Crowd Class
  • Enabling the Raycastable Crowd
  • Testing the Raycastable Crowd
  • Interacting with the Raycastable Crowd Actors
  • Additional configuration
  • Priority Calculation Strategies
  • Area of Influence Strategy
  • Customising the Viewpoint
  • Customising a Raycastable Crowd Actor at runtime
  • Raycastable Crowd Actor Setup
  • Hooks for customising mesh assignment
  • Raycastable Crowd Component

Was this helpful?

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

Raycastable Crowd

Enabling line traces and collisions with actors who are being rendered with Crowd Rendering.

PreviousNotificationsNextSingletons

Last updated 3 months ago

Was this helpful?

Overview

In the Morpheus Platform, the only remote player characters that are represented by physical Actors in the world are those characters that are in , which defaults to the 35 closest players. This means that in a high-scale game, most characters are rendered using the , and don't have physical representations in the world that have colliders.

The Raycastable Crowd is a system to add basic colliders to some of the Crowd members in your world. The Crowd members which have colliders are constantly updated at runtime, according to configurations that you can define, so the Crowd members most relevant for your gameplay mechanics at any given moment can be the characters that have colliders.

Quickstart

Configuring the Raycastable Crowd Actor class

Your Raycastable Crowd Actor is the actor that will act as the collider for the selected Crowd members. Create a subclass of M2 Avatar Raycastable Crowd Actor to create your Raycastable Crowd Actor Class.

M2 Avatar Raycastable Crowd Actor is set up to match the physics asset settings configured in your character's , which is the simplest way to set up your characters and Raycastable Crowd with appropriate skeletons.

Avatar Physics Asset Data: Set this to the AvatarPhysicsAssetData class used in your Morpheus Character's AvatarPhysicsAssetComponent. This makes your Raycastable Crowd Actor's skeleton match the approximate skeleton for the Morpheus Character that this Raycastable Crowd Actor is currently representing.

The Raycastable Crowd Actor will use a capsule component instead if the AvatarPhysicsAssetComponent reports that no valid physics asset was found.

Default Skeletal Mesh: This skeleton will be used for the Raycastable Crowd Actor if no AvatarPhysicsAssetComponent is on the currently represented MorpheusCharacter, or if the character is not using an MML avatar.

Interactable Query and Object Channel: These channels are enabled on the collider that the Raycastable Crowd Actor is currently using. Set these to be the channels used for your gameplay interactions (e.g. line traces for shooting).

Anim Instance Class: Set this if you want your Raycastable Crowd Actor to animate approximately in line with its current Morpheus Character. This has a performance cost.

Debug Visibility: Raycastable Crowd Actors by default are invisible, but set this to true to make them visible for debugging purposes.

Configuring the Raycastable Crowd Class

Your Raycastable Crowd class configures the raycastable crowd, determining how many Raycastable Crowd Actors to use and which strategy to use to assign Raycastable Crowd Actors to Morpheus Characters at runtime. Create a subclass of Raycastable Crowdto create your Raycastable Crowd Class.

Raycastable Crowd Actor Class: Set this to the Raycastable Crowd Actor Class that you created in the previous section.

Num Raycastable Crowd Actors: The total number of Raycastable Crowd Actors for this Raycastable Crowd in use at any time. This is the maximum number of Crowd members that can be currently represented by a Raycastable Crowd Actor. If this number is too low, you'll find that players will end up trying to interact with Crowd members that don't have Raycastable Crowd Actors, and so the interaction won't register. 20 is a sensible default.

Priority Calculation: This determines on a frame-by-frame basis which Morpheus Characters get assigned a Raycastable Crowd Actor. The Morpheus Characters with the highest priority in any frame get assigned the Raycastable Crowd Actors. The setting in the above screenshot is good starting point - it prioritises Morpheus Actors that are within 10 degrees field of view of the local camera, calculated with a view frustum, so approximately any crowd member that your cursor is over in a shooter game will be assigned a Raycastable Crowd Actor. Full details of the different strategies are described below.

Update View Info Interval: How often to update the data used for the priority calculation.

Enabling the Raycastable Crowd

Set the Raycastable Crowd Class to the class you just created.

You can create multiple Animated Crowds, and each crowd a separate Raycastable Crowd Class (with a separate pool of Raycastable Crowd Actors) can be used.

Your Raycastable Crowd should now be fully configured!

Testing the Raycastable Crowd

To see the Raycastable Crowd in action, you can:

  • Temporarily enable Debug Visibility in your Raycastable Crowd Actor class;

  • Temporarily set Num Raycastable Crowd Actors in your Raycastable Crowd class to 1;

  • Start a PIE deployment with 3 clients;

You should be able to see the visible Raycastable Crowd Actor on the character that your cursor is currently closest to.

Interacting with the Raycastable Crowd Actors

Just as with regular Render Targets, the Get Morpheus Actor function will return the MorpheusActor that is currently associated with the Raycastable Crowd Actor.

This means that for any physical interaction such as a line query that returns an Actor, the Get Morpheus Actor function will return the associated MorpheusActor, regardless of whether the Actor is the MorpheusActor's Render Target or a Raycastable Crowd Actor.

Additional configuration

Priority Calculation Strategies

You can configure the priority calculation using multiple strategies to configure which Morpheus Characters should currently have Raycastable Crowd Actors. Multiple strategies can be used in combination.

  • Strategies Enabled : Selector for which prioritization strategies to be used.

  • There are currently 3 prioritization strategies that can selectively enabled:

    1. View Frustum:

      • Prioritizes crowd members within the View Frustum specified using the Field of View Degrees and Near Clip Plane.

      • The priority returned will be square the distance between the crowd member and the View location.

      • Uses the FMinimalViewInfo data returned via UpdateViewInfo function.

    2. Field of View:

      • Prioritizes crowd members that are within the specified Field of View Degrees angle.

      • The priority returned will be the 1/cosineof the angle of the crowd member and optionally scale that by distance if ScaleByDistance is enabled.

      • Doesn't consider the crowd member size like the View Frustum Strategy.

      • Uses the FMinimalViewInfo data returned via UpdateViewInfo function.

    3. Area of Influence:

      • Prioritizes crowd members that are within user-defined Areas of Influence.

      • Use the functionsAddAreaofInfluence and ClearAreasOfInfluence to control the behaviour of this strategy during runtime.

      • Scales the priority by the squared distance from the center of the Area of Influence.

      • Further details on this strategy below.

Area of Influence Strategy

The Area of Influence strategy allows you to prioritise characters near certain coordinates. This can be used to give Raycastable Crowd Actors to characters who are near projectiles or other items that need to interact with crowd members.

When using this strategy, the areas of influence need to be added and removed at runtime using AddAreaofInfluence and ClearAreasOfInfluence in Raycastable Crowd class. To do this, you'll need a reference to your Raycastable Crowd, which you can get with Get All Actors Of Class. Note that there can be multiple Raycastable Crowd objects, and they only spawn when any players have entered the crowd, so you can't just cache them at the start of the game.

Customising the Viewpoint

The viewpoint from which the priority calculations are based is set with Update View Info . By default, this returns the FMinimalViewInfo of the player's camera. This can be overridden in the Raycastable Crowd class to provide a custom viewpoint for the priority calculations.

Customising a Raycastable Crowd Actor at runtime

You may want to change the Raycastable Crowd Actor's mesh from the defaults at runtime. For example, if a gameplay effect has added a forcefield surrounding the character, you might need the Raycastable Crowd Actor to reflect this, so that collisions in the crowd are still accurate.

Raycastable Crowd Actor Setup

When the Raycastable Crowd Actor is initialised, a number of SkeletalMeshComponents are created according to all the meshes that the Raycastable Crowd Actor could represent, based on the AvatarPhysicsAsset data. A capsule component is also created. You can access these by getting the children of the scene component.

Only one of these components has their collision responses enabled at any time, which is the component that matches the avatar the currently assigned Morpheus Character is using.

Hooks for customising mesh assignment

When a new Morpheus Actor is assigned to a Raycastable Crowd Actor, or the Raycastable Crowd Actor needs to update its current mesh for another reason (e.g. its Morpheus Character changes what avatar it is using), RaycastableMeshUpdate is called.

The default implementation of RaycastableMeshUpdate calls SetMeshCollisionsFromUserAvatar. Override RaycastableMeshUpdate to customise what happens in this step.

Don't forget the case where your Raycastable Crowd Actor needs to update its mesh even when its Morpheus Character hasn't changed! You'll need to call Raycastable Mesh Update yourself. This is easier with the Raycastable Crowd Component (below).

Raycastable Crowd Component

The Raycastable Crowd Component is a component on every Morpheus Pawn class that exposes the above hooks from your Morpheus Pawn class, instead of needing references to the Raycastable Crowd Actors.

Call ForceRaycastableCrowdActorUpdate to cause RaycastableMeshUpdate to fire, if you need your Raycastable Crowd Actor to update while it is assigned to a Morpheus Character.

You can also write your entire Raycastable Crowd Actor's custom logic in your Morpheus Character by binding to OnRaycastableCrowdActorAssigned and OnUpdateRaycastableCrowdActor.

T

Navigate to the of your .

Use the JunoGameData.SetValue game PlayerClient.Rendering.NumInLoD0 0 to force all players other than your local player into the Crowd

console command
🎮
📚
Crowd
AvatarPhysicsAssetComponent
LoD 0
animated crowd render target section
Pawn Set asset
The white skeleton is the mesh that the Raycastable Crowd Actor is using.
This graph will print the name of the MorpheusActor that the line trace hit actor is associated with, whether that actor is a Render Target or a Raycastable Crowd Actor.
This is called whenever Cached Raycastable Crowds is empty to lazily initialize the cache.
This is called each tick to give Raycastable Crowd Actors to all characters near any projectile.
Update View Info is called whenever the priority calculations are made.
In this example, I want my Raycastable Crowd Actor to ignore its usual behaviour and just use a Sphere as its collider whenever my character's IsInBubble variable is true. I have added my own Sphere component to the actor, and in the false branch, I disable the Sphere and call the regular Raycastable Crowd Actor before.
This Blueprint is in my Morpheus Character. I need my Raycastable Crowd Actor to update its mesh if my player enables or disables their bubble. This causes the above Raycastable Mesh Update to fire when my IsInBubble variable changes on the character.
I can implement the above custom RaycastableMeshUpdate in my Morpheus Character instead, using RaycastableCrowdComponent.OnUpdateRaycastableCrowdActor .
Page cover image