diff --git a/Source/DisplayClusterExtensions/Private/DisplayClusterPawnCAVE.cpp b/Source/DisplayClusterExtensions/Private/DisplayClusterPawnCAVE.cpp index 5855da424d51b3c12c40d013042cb450eff123e0..45ae5d75edaeb1ed733222f06528ebdf3223295a 100644 --- a/Source/DisplayClusterExtensions/Private/DisplayClusterPawnCAVE.cpp +++ b/Source/DisplayClusterExtensions/Private/DisplayClusterPawnCAVE.cpp @@ -71,11 +71,11 @@ void ADisplayClusterPawnCAVE::OnLookUpRate_Implementation(flo AddControllerPitchInput(BaseTurnRate * Rate * GetWorld()->GetDeltaSeconds() * CustomTimeDilation); } } -void ADisplayClusterPawnCAVE::OnFire_Implementation () +void ADisplayClusterPawnCAVE::OnFire_Implementation (bool Pressed) { } -void ADisplayClusterPawnCAVE::OnAction_Implementation (int32 Index) +void ADisplayClusterPawnCAVE::OnAction_Implementation (bool Pressed, int32 Index) { } @@ -110,7 +110,7 @@ void ADisplayClusterPawnCAVE::Tick (flo const float Mult = GetWorld()->GetWorldSettings()->WorldToMeters / 100.f; SetActorScale3D(FVector(Mult, Mult, Mult)); - if (!Flystick) + if (!Flystick && IDisplayCluster::Get().GetOperationMode() == EDisplayClusterOperationMode::Cluster) Flystick = IDisplayCluster::Get().GetGameMgr()->GetNodeById(TEXT("flystick")); // There MUST be an scene node called flystick in the config. } void ADisplayClusterPawnCAVE::BeginDestroy () @@ -124,16 +124,24 @@ void ADisplayClusterPawnCAVE::SetupPlayerInputComponent (UIn Super::SetupPlayerInputComponent(PlayerInputComponent); if (PlayerInputComponent) { - PlayerInputComponent->BindAxis ("MoveForward" , this, &ADisplayClusterPawnCAVE::OnForward ); - PlayerInputComponent->BindAxis ("MoveRight" , this, &ADisplayClusterPawnCAVE::OnRight ); - PlayerInputComponent->BindAxis ("TurnRate" , this, &ADisplayClusterPawnCAVE::OnTurnRate ); - PlayerInputComponent->BindAxis ("LookUpRate" , this, &ADisplayClusterPawnCAVE::OnLookUpRate); - PlayerInputComponent->BindAction ("Fire" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnFire ); - PlayerInputComponent->BindAction<FButtonDelegate>("Action1" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , 1); - PlayerInputComponent->BindAction<FButtonDelegate>("Action2" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , 2); - PlayerInputComponent->BindAction<FButtonDelegate>("Action3" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , 3); - PlayerInputComponent->BindAction<FButtonDelegate>("Action4" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , 4); - PlayerInputComponent->BindAction<FButtonDelegate>("Action5" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , 5); + PlayerInputComponent->BindAxis ("MoveForward" , this, &ADisplayClusterPawnCAVE::OnForward ); + PlayerInputComponent->BindAxis ("MoveRight" , this, &ADisplayClusterPawnCAVE::OnRight ); + PlayerInputComponent->BindAxis ("TurnRate" , this, &ADisplayClusterPawnCAVE::OnTurnRate ); + PlayerInputComponent->BindAxis ("LookUpRate" , this, &ADisplayClusterPawnCAVE::OnLookUpRate ); + + PlayerInputComponent->BindAction<FFireDelegate> ("Fire" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnFire , true ); + PlayerInputComponent->BindAction<FActionDelegate>("Action1" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , true , 1); + PlayerInputComponent->BindAction<FActionDelegate>("Action2" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , true , 2); + PlayerInputComponent->BindAction<FActionDelegate>("Action3" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , true , 3); + PlayerInputComponent->BindAction<FActionDelegate>("Action4" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , true , 4); + PlayerInputComponent->BindAction<FActionDelegate>("Action5" , IE_Pressed , this, &ADisplayClusterPawnCAVE::OnAction , true , 5); + + PlayerInputComponent->BindAction<FFireDelegate> ("Fire" , IE_Released, this, &ADisplayClusterPawnCAVE::OnFire , false ); + PlayerInputComponent->BindAction<FActionDelegate>("Action1" , IE_Released, this, &ADisplayClusterPawnCAVE::OnAction , false, 1); + PlayerInputComponent->BindAction<FActionDelegate>("Action2" , IE_Released, this, &ADisplayClusterPawnCAVE::OnAction , false, 2); + PlayerInputComponent->BindAction<FActionDelegate>("Action3" , IE_Released, this, &ADisplayClusterPawnCAVE::OnAction , false, 3); + PlayerInputComponent->BindAction<FActionDelegate>("Action4" , IE_Released, this, &ADisplayClusterPawnCAVE::OnAction , false, 4); + PlayerInputComponent->BindAction<FActionDelegate>("Action5" , IE_Released, this, &ADisplayClusterPawnCAVE::OnAction , false, 5); } } UPawnMovementComponent* ADisplayClusterPawnCAVE::GetMovementComponent () const diff --git a/Source/DisplayClusterExtensions/Public/DisplayClusterPawnCAVE.h b/Source/DisplayClusterExtensions/Public/DisplayClusterPawnCAVE.h index 09ec2f3f376c95ffce7750f5f76c3044bb765852..e2e9b9e6ada2a5fc1b70c03d1a0429c02eb9f429 100644 --- a/Source/DisplayClusterExtensions/Public/DisplayClusterPawnCAVE.h +++ b/Source/DisplayClusterExtensions/Public/DisplayClusterPawnCAVE.h @@ -15,18 +15,19 @@ class DISPLAYCLUSTEREXTENSIONS_API ADisplayClusterPawnCAVE : public ADisplayClus GENERATED_UCLASS_BODY() public: - UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnForward (float Value); - UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnRight (float Value); - UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnTurnRate (float Rate ); - UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnLookUpRate(float Rate ); - UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnFire (); - UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnAction (int32 Index); + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnForward (float Value ); + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnRight (float Value ); + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnTurnRate (float Rate ); + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnLookUpRate(float Rate ); + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnFire (bool Pressed); + UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pawn") void OnAction (bool Pressed, int32 Index); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn") float BaseTurnRate = 45.0f ; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn") UDisplayClusterSceneComponent* Flystick = nullptr; protected: - DECLARE_DELEGATE_OneParam(FButtonDelegate, int32); + DECLARE_DELEGATE_OneParam (FFireDelegate , bool); + DECLARE_DELEGATE_TwoParams(FActionDelegate, bool, int32); virtual void BeginPlay () override; virtual void Tick (float DeltaSeconds ) override;