Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "IXRTrackingSystem.h"
#include "GameInstances/ProjectMobiusGameInstance.h"
#include "Subsystems/MobiusControllerSubsystem.h"
#include "MassAI/SubSystems/PedestrianSignalSubsystem.h"
#include "SubSystems/TimeDilationSubSystem.h"
#include "Subsystems/MobiusUserFeedbackSubsystem.h"
#include "Util/FrameGrabberHelper.h"
Expand Down Expand Up @@ -110,6 +111,16 @@ void AMobiusController::Tick(float DeltaTime)
{
FrameGrabberHelper->Tick(DeltaTime);
}

// 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.
Comment on lines +115 to +116
if (bClickSelectsAgent && WasInputKeyJustPressed(EKeys::LeftMouseButton))
{
if (UMobiusControllerSubsystem* ControllerSub = GetWorld()->GetSubsystem<UMobiusControllerSubsystem>())
{
ControllerSub->SelectPedestrianFromMousePosition();
}
}
}

void AMobiusController::GetScreenshotRequiredSubsystemsAndData()
Expand Down Expand Up @@ -498,6 +509,24 @@ void AMobiusController::InterpolateCameraToTransform(const FTransform& TargetTra
}
}

void AMobiusController::MobiusActivateCollisions()
{
if (UPedestrianSignalSubsystem* SignalSub = GetWorld()->GetSubsystem<UPedestrianSignalSubsystem>())
{
UE_LOG(LogTemp, Display, TEXT("MobiusActivateCollisions: firing CollisionsSettingChanged(1)"));
SignalSub->CollisionsSettingChanged(1);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("MobiusActivateCollisions: PedestrianSignalSubsystem not found"));
}
}

void AMobiusController::MobiusToggleClickSelect()
{
bClickSelectsAgent = !bClickSelectsAgent;
UE_LOG(LogTemp, Display, TEXT("Native click-select: %s"), bClickSelectsAgent ? TEXT("on") : TEXT("off"));
}

void AMobiusController::CycleCameraSavePoints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ void UDisableCollisionSignalProcessor::Initialize(UObject& Owner)
{
// Subscribe to the signals we want to handle in this processor
UMassSignalSubsystem* SignalSubsystem = UWorld::GetSubsystem<UMassSignalSubsystem>(Owner.GetWorld());
SubscribeToSignal(*SignalSubsystem, PedestrianDataSignals::Signals::ActivateCollisions);// check that this is needed feels wrong
// Only DeactivateCollisions: subscribing to ActivateCollisions as well made this
// processor re-disable the entities the enable processor had just enabled, so the
// collision capsules never activated and agent selection always missed.
SubscribeToSignal(*SignalSubsystem, PedestrianDataSignals::Signals::DeactivateCollisions);
Super::Initialize(Owner);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ UMassEntitySpawnSubsystem* UPedestrianSignalSubsystem::GetSpawnSubsystem()

void UPedestrianSignalSubsystem::CollisionsSettingChanged(uint8 EnableDisable)
{
UE_LOG(LogTemp, Display, TEXT("Pedestrian CollisionsSettingChanged"));
UE_LOG(LogTemp, Display, TEXT("Pedestrian CollisionsSettingChanged value=%d"), EnableDisable);
if (EnableDisable == 0)
{
DeactivateCollisions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ class PROJECTMOBIUS_API AMobiusController : public APlayerController
UFUNCTION(BlueprintCallable, Category = "MobiusController|Methods|CameraSave")
void CycleCameraSavePoints();

/** 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 +99 to +103
private:
/** Route plain LMB clicks into the C++ selection trace; the BP click path is unreliable */
bool bClickSelectsAgent = true;

public:
#pragma region PROPERTIES
/** Ptr to the Time dialation subsystem to get the current simulation time */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MobiusController|Properties")
Expand Down
Loading