Skip to content

Fix agent click-selection never working - #19

Open
chraibi wants to merge 1 commit into
sir306:mainfrom
PedestrianDynamics:fix-agent-selection
Open

Fix agent click-selection never working#19
chraibi wants to merge 1 commit into
sir306:mainfrom
PedestrianDynamics:fix-agent-selection

Conversation

@chraibi

@chraibi chraibi commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Agent selection (red select-mode button, then click a pedestrian) never worked on our machines. Root cause:

UDisableCollisionSignalProcessor::Initialize subscribes to both ActivateCollisions and DeactivateCollisions — so the same signal that enables the pedestrian hit-capsules immediately re-disables them (Enabled tag → Disabled) in the same frame. PedestrianCollisionProcessor (requires Enabled, excludes Disabled) 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:

  • Native left-click → SelectPedestrianFromMousePosition() from the controller tick (the BP click path never reached C++ in our sessions; the call is idempotent if BP also fires it)
  • MobiusActivateCollisions console fallback for the red button
  • MobiusToggleClickSelect escape hatch
  • Log the value passed to CollisionsSettingChanged

Known limitation (pre-existing, unchanged): ActivateCollisions silently 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).

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.
Copilot AI lite review requested due to automatic review settings August 11, 2026 17:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ActivateCollisions subscription from UDisableCollisionSignalProcessor::Initialize.
  • Add native LMB click-to-select in AMobiusController::Tick plus 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants