Fix agent click-selection never working - #19
Open
chraibi wants to merge 1 commit into
Open
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.
Comment on lines
+99
to
+103
| /** 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(); | ||
|
|
Comment on lines
+115
to
+116
| // 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).