diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index 6e88a3cb3c08f7bdef2d9c9a29d2881be0ba2899..da433a267e744ac2871d2f0013db6f545cd8917d 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -93,6 +93,8 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen { Super::SetupPlayerInputComponent(PlayerInputComponent); + ThisPlayerInputComponent = PlayerInputComponent; + APlayerController* PlayerController = Cast<APlayerController>(GetController()); if (!PlayerController) { @@ -145,6 +147,12 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen } } +UInputComponent* ARWTHVRPawn::GetPlayerInputComponent() +{ + return ThisPlayerInputComponent; +} + + void ARWTHVRPawn::AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const { if (Context) diff --git a/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h index f9d03b513f1e7f1c4da813240436982063f9ab24..ef8548c76182a54a42dca18a62291347b5bbf626 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h +++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h @@ -19,6 +19,7 @@ class RWTHVRTOOLKIT_API UMovementComponentBase : public UActorComponent, public public: // Already sets up VRPawn and InputSubsystem properties that can be used by child classes. + UFUNCTION(BlueprintCallable) virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override; protected: diff --git a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h index ca774d3766c41da61f095c06e27ceaa115324094..d9a6200a15a3c888985006beeda57450bc4443bc 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h +++ b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h @@ -87,6 +87,9 @@ protected: virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override; void AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const; + UFUNCTION(BlueprintCallable) + UInputComponent* GetPlayerInputComponent(); + /* LiveLink helper function called on tick */ void EvaluateLivelink() const; @@ -109,4 +112,8 @@ protected: /* Set device specific motion controller sources (None, L/R, Livelink) */ void SetupMotionControllerSources(); + +private: + + UInputComponent* ThisPlayerInputComponent; };