Skip to content
Snippets Groups Projects
Commit 04532420 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

refactor(pawn, interaction): removes legacy fire & toggle mode input actions

parent f90ef144
No related branches found
No related tags found
1 merge request!52refactor(pawn, interaction): removes legacy fire & toggle mode input actions
No preview for this file type
File deleted
File deleted
File deleted
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "Engine/LocalPlayer.h" #include "Engine/LocalPlayer.h"
#include "GameFramework/PlayerController.h" #include "GameFramework/PlayerController.h"
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "ILiveLinkClient.h" #include "ILiveLinkClient.h"
#include "Core/RWTHVRPlayerState.h" #include "Core/RWTHVRPlayerState.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
...@@ -14,7 +12,6 @@ ...@@ -14,7 +12,6 @@
#include "Pawn/Navigation/VRPawnMovement.h" #include "Pawn/Navigation/VRPawnMovement.h"
#include "Pawn/ReplicatedCameraComponent.h" #include "Pawn/ReplicatedCameraComponent.h"
#include "Pawn/ReplicatedMotionControllerComponent.h" #include "Pawn/ReplicatedMotionControllerComponent.h"
#include "Pawn/VRPawnInputConfig.h"
#include "Roles/LiveLinkTransformTypes.h" #include "Roles/LiveLinkTransformTypes.h"
#include "Utility/VirtualRealityUtilities.h" #include "Utility/VirtualRealityUtilities.h"
...@@ -100,16 +97,6 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput ...@@ -100,16 +97,6 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput
// There is probably a checkbox or way of spawning that prevents that in a better way that this, change if found. // There is probably a checkbox or way of spawning that prevents that in a better way that this, change if found.
PlayerController->SetControlRotation(FRotator::ZeroRotator); PlayerController->SetControlRotation(FRotator::ZeroRotator);
const ULocalPlayer* LP = PlayerController->GetLocalPlayer();
UEnhancedInputLocalPlayerSubsystem* InputSubsystem = LP
? LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>()
: nullptr;
if (!InputSubsystem)
{
UE_LOG(Toolkit, Error, TEXT("[VirtualRealiytPawn.cpp] InputSubsystem IS NOT VALID"));
return;
}
SetupMotionControllerSources(); SetupMotionControllerSources();
// Should not do this here but on connection or on possess I think. // Should not do this here but on connection or on possess I think.
...@@ -135,19 +122,6 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput ...@@ -135,19 +122,6 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput
PlayerController->bEnableMouseOverEvents = true; PlayerController->bEnableMouseOverEvents = true;
} }
InputSubsystem->ClearAllMappings();
// add Input Mapping context
InputSubsystem->AddMappingContext(IMCBase, 0);
UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(PlayerInputComponent);
// old function bindings for grabbing and releasing
EI->BindAction(Fire, ETriggerEvent::Started, this, &AVirtualRealityPawn::OnBeginFire);
EI->BindAction(Fire, ETriggerEvent::Completed, this, &AVirtualRealityPawn::OnEndFire);
EI->BindAction(ToggleNavigationMode, ETriggerEvent::Started, this, &AVirtualRealityPawn::OnToggleNavigationMode);
// Set up mappings on input extension components, need to do this nicely // Set up mappings on input extension components, need to do this nicely
for (UActorComponent* Comp : GetComponentsByInterface(UInputExtensionInterface::StaticClass())) for (UActorComponent* Comp : GetComponentsByInterface(UInputExtensionInterface::StaticClass()))
...@@ -274,44 +248,6 @@ void AVirtualRealityPawn::SetCameraOffset() const ...@@ -274,44 +248,6 @@ void AVirtualRealityPawn::SetCameraOffset() const
HeadCameraComponent->SetWorldLocationAndRotation(Location, Rotation); HeadCameraComponent->SetWorldLocationAndRotation(Location, Rotation);
} }
// legacy grabbing
void AVirtualRealityPawn::OnBeginFire(const FInputActionValue& Value)
{
UE_LOG(LogTemp, Warning, TEXT("BeginFire"));
BasicVRInteraction->BeginInteraction();
}
// legacy grabbing
void AVirtualRealityPawn::OnEndFire(const FInputActionValue& Value)
{
UE_LOG(Toolkit, Log, TEXT("EndFire"));
BasicVRInteraction->EndInteraction();
}
void AVirtualRealityPawn::OnToggleNavigationMode(const FInputActionValue& Value)
{
switch (PawnMovement->NavigationMode)
{
case EVRNavigationModes::NAV_FLY:
PawnMovement->NavigationMode = EVRNavigationModes::NAV_WALK;
UE_LOG(Toolkit, Log, TEXT("Changed Nav mode to WALK"));
break;
case EVRNavigationModes::NAV_WALK:
PawnMovement->NavigationMode = EVRNavigationModes::NAV_GHOST;
UE_LOG(Toolkit, Log, TEXT("Changed Nav mode to GHOST"));
break;
case EVRNavigationModes::NAV_GHOST:
PawnMovement->NavigationMode = EVRNavigationModes::NAV_FLY;
UE_LOG(Toolkit, Log, TEXT("Changed Nav mode to FLY"));
break;
default:
PawnMovement->NavigationMode = EVRNavigationModes::NAV_WALK;
UE_LOG(Toolkit, Log, TEXT("Changed Nav mode to WALK"));
break;
}
}
void AVirtualRealityPawn::ApplyLiveLinkTransform(const FTransform& Transform, void AVirtualRealityPawn::ApplyLiveLinkTransform(const FTransform& Transform,
const FLiveLinkTransformStaticData& StaticData) const const FLiveLinkTransformStaticData& StaticData) const
{ {
......
...@@ -88,26 +88,6 @@ protected: ...@@ -88,26 +88,6 @@ protected:
/* Helper function that applies the LiveLink data to this component. Taken from the LiveLink Transform Controller. */ /* Helper function that applies the LiveLink data to this component. Taken from the LiveLink Transform Controller. */
void ApplyLiveLinkTransform(const FTransform& Transform, const FLiveLinkTransformStaticData& StaticData) const; void ApplyLiveLinkTransform(const FTransform& Transform, const FLiveLinkTransformStaticData& StaticData) const;
/* Interaction */
UFUNCTION(BlueprintCallable, Category = "Pawn|Interaction")
void OnBeginFire(const FInputActionValue& Value);
UFUNCTION(BlueprintCallable, Category = "Pawn|Interaction")
void OnEndFire(const FInputActionValue& Value);
UFUNCTION(BlueprintCallable)
void OnToggleNavigationMode(const FInputActionValue& Value);
/* Input */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pawn|Input")
UInputMappingContext* IMCBase;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pawn|Input")
UInputAction* Fire;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pawn|Input")
UInputAction* ToggleNavigationMode;
/* Fixes camera rotation in desktop mode. */ /* Fixes camera rotation in desktop mode. */
void SetCameraOffset() const; void SetCameraOffset() const;
void UpdateRightHandForDesktopInteraction() const; void UpdateRightHandForDesktopInteraction() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment