LogoLogo
What's new?StatusMSquared
  • Morpheus Platform Documentation
  • What is Morpheus Platform?
    • Glossary
    • Interoperability
    • Support
    • EULA
  • Firewall Problems
  • 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
      • Editor Versions
      • Performance Guarantees
      • 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
          • CrowdAudioComponent advanced configuration
        • 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
        • 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
      • 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 Requirements
      • Broadcast
        • OBS Integration
      • Failover
      • Capacity and Queue Management
  • ADMINS
    • Access Control
      • Add Metaverse Contributors
      • Create 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
  • Dashboard
    • Assets
      • Assets Versions
      • Engine Plugins
      • Project Plugins
      • Templates
    • Releases
  • Integrations
    • Analytics
      • Send Events from Web
      • Send Events from Unreal
    • Chat
      • Integrate Pubnub with your Unreal Project
      • Add Moderation to Chat
Powered by GitBook
On this page
  • Overview
  • Manual Selector Modes
  • Usage
  • Configuring the module data
  • Getting your currently selected characters
  • About Marquee Selection

Was this helpful?

  1. CREATION
  2. Unreal Development
  3. Features & Guides
  4. Inventory
  5. How to Make Devices
  6. Device Settings
  7. Device Modules

Player Selector

Last updated 1 year ago

Was this helpful?

Overview

The Player Selector device module (BP_DeviceModule_PlayerSelector) allows the gadget to have the functionality to select players in different ways.

There are a few different ways of selecting a player using the selector module:

  • Manually: Click on players, or drag a rectangle over a group of players. For more details, see Manual Selector Modes.

  • By role: Selects everyone by their current role (the list matches your level's roles table, with roles like "participant", "presenter", etc.)

  • By tag: Selects people by their tags (handled by the M2M User Tag Component). You can manually add tags to players using M2M_UserTagComponent::AddUserTag.

  • Select Everyone

This item needs to have the module added to its item executor's button data to be used. For more details on how to configure the module, and listen to its events, see Usage.

Manual Selector Modes

Player Individual

This mode allows the user to select a character using a line trace from the mouse to the world. It will select the first Actor it detects that is/inherits from BP_M2_PlayerCharacterBase. To select people using this mode simply move the cursor over a character and do a quick tap to the Left Mouse Button

Player Combined

This mode combines Player Individual with a Marquee mode.

The Marquee mode allows the user to draw a rectangle on the screen and select all the characters that are contained in that box. A quick tap to the Left Mouse Button will use the Individual mode option with the same functionality as described above. Holding the Left Mouse Button for a brief moment will enable the Marquee mode and the user will see a border being drawn on the screen. Releasing the Left Mouse Button will select all the characters that are within this border.

Usage

To have the ability to select players with a gadget the BP_DeviceModule_PlayerSelector needs to be added to the Button data used by the gadget ItemExecutor. This will add the UI for the device as well as adding the functionality to select the players using the mouse.

Configuring the module data

There are various properties in the player selector module, which can be configured depending on your use case:

  • ShortcutAction/ShortcutMapping - controls what button is used for making manual selections. The recommended shortcuts are IA_PresenterSelector1/2 which are bound to left and right click respectively.

  • AllowTagSelection - if this is true, the "Select by tag" option will be available (it will be hidden if not)

  • AllowRoleSelection - if this is true, the "Select by role" option will be available

  • AllowSelfSelection - if this is true, you will be able to click on your own character and treat them as a selection. (If not, you will only be able to click on other characters)

  • AllowSelectAll - if this is true, the "Select everyone" button will be present

  • AllowPluralManualSelection - if this is true, then selecting people will be done in "additive mode" - i.e. selecting new people will add to the group of selected people. If the flag is false, making a new manual selection will replace the old manual selection.

  • ShowSelectionInstructions - if true, there will be some info text added to the controls widget for the item.

  • DefaultToSelectEveryone - if true, this marks to the UI that having nobody selected means everyone is selected. This is used e.g. by BP_ItemExecutor_ItemGranter. NOTE: This is only a UI flag, actually selecting everyone will need to be done implementation-side.

  • AllowManualSelection - not currently used

Getting your currently selected characters

The player selector module exposes a OnSelectionUpdated event, which triggers whenever the selection changes.

It also has a GetSelection method, which returns all the current selection details, both from manual selection and roles/tags. This can be passed to the ability, so that the ability's effects are applied to the correct people

In the ability, you can then use one of two flows (using helpers from BPFL_DeviceModules):

  • On the clients, you can check SelectionIncludesPlayer, to know whether an ability applies to the provided morpheus actor:

  • If applying the ability on the server, you can use the GetAllSelectedPlayers helper. NOTE: This iterates over all characters currently in the world, so won't scale well at high player counts. If you are running large scale events, take care when using this flow.

Be also sure to enable the PlayerSelector module on the "InitializeExecutor" event and disable it on the "TearDownExecutor" event

About Marquee Selection

Detecting Actors On Rectangle

The marquee functionality uses a modified function from the Unreal Engine source code. "AHUD::GetActorsInSelectionRectangle" is a function that given 2 points will return an array of actors that are on the same screen position as the rectangle formed by those 2 points. This function can not be used as is only available during HUD draw calls. The modified version lives under AJ_BaseHUD::IsBoundingBoxInRectangle. This modified version uses a similar functionality but instead of going through all the actors in the world it will receive a FBox that are the bounds of an actor on Local Space, the center position of the bounding box in World Space and the 2 points of the rectangle. This allows the function to work with any bounding box provided. It also has the option to requiere the bounding box to be fully enclosed in the rectangle.

Showing Marquee Selection Border

To be able to show the Rectangle on screen the WBP_MarqueeSelector widget must be spawned. It contains the basic functionality to get a border on screen and get the coordenates afterwards to be used with the detection. Once the widget is spawned the order of operation is the following (No need to use mouse coordinates):

  • Call "SetStartingLocation" with the mouse coordinates

  • Make the border visible calling "SetVisible"

  • Update the coordinates of the second point of the rectangle using "UpdatedMouseLocation".

  • To get the rectangle coordinates call "GetFixedRectangleForSelection" which return a transformed coordinates to take into account the scale of the window.

  • Call "ResetValues" to clear the rectangle and hide the border

LastActiveGizmoMode - controls how will be controlled. Set this to either PlayerCombined to handle clicking on people or using the marquee mode, or PlayerIndividual if you only want to support clicking on people directly. (The naming of this variable for user readability will be updated in future)

The BP_Presenter_Selector
Border of a Marquee selection
Button data on BP_ItemExecutor_Silencer_PlayerSelector