Fix agent click-selection never working - #19
Conversation
Agent selection (red button, then click a pedestrian) never worked because UDisableCollisionSignalProcessor was subscribed to the ActivateCollisions signal as well as DeactivateCollisions - the very signal that enables selection also re-disabled it in the same frame, so the pedestrian hit-capsules never activated and the selection trace could not hit anything. Drop the wrong subscription; the existing "feels wrong" comment on it was right. Route plain left-clicks into the C++ selection trace from the controller (the BP click path proved unreliable), add a MobiusActivateCollisions console fallback for the red button, a MobiusToggleClickSelect escape hatch, and log the value passed to CollisionsSettingChanged. Known limitation, unchanged: ActivateCollisions is a silent no-op when pressed before any agents have spawned.
There was a problem hiding this comment.
Pull request overview
Fixes pedestrian/agent click-selection by preventing UDisableCollisionSignalProcessor from handling the ActivateCollisions signal (which previously caused collisions to be immediately re-disabled), and adds controller-side selection + console fallbacks to make selection more reliable.
Changes:
- Remove the incorrect
ActivateCollisionssubscription fromUDisableCollisionSignalProcessor::Initialize. - Add native LMB click-to-select in
AMobiusController::Tickplus console commands to activate collisions and toggle click-selection. - Improve logging for collision setting changes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| UnrealFolder/ProjectMobius/Source/ProjectMobius/Public/Controller/MobiusController.h | Adds exec console command declarations and a private toggle flag for native click-selection. |
| UnrealFolder/ProjectMobius/Source/ProjectMobius/Private/Controller/MobiusController.cpp | Implements native LMB click-to-select in Tick and adds exec console command implementations. |
| UnrealFolder/ProjectMobius/Source/ProjectMobius/Private/MassAI/SubSystems/PedestrianSignalSubsystem.cpp | Logs the enable/disable value passed into CollisionsSettingChanged. |
| UnrealFolder/ProjectMobius/Source/ProjectMobius/Private/MassAI/SignalProcessors/EnableCollisionSignalProcessor.cpp | Removes ActivateCollisions subscription from the disable signal processor to prevent immediate re-disable. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /** Console fallback for the red select-mode button: fires the ActivateCollisions signal. */ | ||
| UFUNCTION(Exec) void MobiusActivateCollisions(); | ||
| /** Toggle the native left-click agent selection (on by default). */ | ||
| UFUNCTION(Exec) void MobiusToggleClickSelect(); | ||
|
|
| // Native click-to-select: runs the same trace the BP click path should trigger. | ||
| // Selecting is a no-op until collisions are activated, so this is safe by default. |
|
Hey the click system does work, but you have to toggle the click action on (button on the playbar or hold control when clicking) turning on the collisions to always be on to pick up click actions will tank the performance as it has to calculate physics when moving collisions. |
Agent selection (red select-mode button, then click a pedestrian) never worked on our machines. Root cause:
UDisableCollisionSignalProcessor::Initializesubscribes to bothActivateCollisionsandDeactivateCollisions— so the same signal that enables the pedestrian hit-capsules immediately re-disables them (Enabledtag →Disabled) in the same frame.PedestrianCollisionProcessor(requiresEnabled, excludesDisabled) then never runs, capsules never track agents, and the selection trace can't hit anything. The existing comment on that line — "check that this is needed feels wrong" — was right; this PR drops the wrong subscription.Also included:
SelectPedestrianFromMousePosition()from the controller tick (the BP click path never reached C++ in our sessions; the call is idempotent if BP also fires it)MobiusActivateCollisionsconsole fallback for the red buttonMobiusToggleClickSelectescape hatchCollisionsSettingChangedKnown limitation (pre-existing, unchanged):
ActivateCollisionssilently no-ops if pressed before any agents have spawned — worth queuing the activation, happy to follow up.Verified on macOS: selection now fills the stats panel and shows the follow indicator (Agent ID, demographics, live speed/position).