Skip to content
Snippets Groups Projects
Commit bf6f9f41 authored by Daniel Rupp's avatar Daniel Rupp
Browse files

Added Nav Mode Toggle

parent 94e50e57
Branches
Tags
1 merge request!13Draft: Improve walking implementation
No preview for this file type
No preview for this file type
No preview for this file type
File added
No preview for this file type
No preview for this file type
......@@ -78,6 +78,8 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput
EI->BindAction(InputActions->Fire, ETriggerEvent::Started, this, &AVirtualRealityPawn::OnBeginFire);
EI->BindAction(InputActions->Fire, ETriggerEvent::Completed, this, &AVirtualRealityPawn::OnEndFire);
EI->BindAction(InputActions->ToggleNavigationMode,ETriggerEvent::Started,this,&AVirtualRealityPawn::ToggleNavigationMode);
// grabbing
EI->BindAction(InputActions->Grab, ETriggerEvent::Started, this, &AVirtualRealityPawn::OnBeginGrab);
EI->BindAction(InputActions->Grab, ETriggerEvent::Completed, this, &AVirtualRealityPawn::OnEndGrab);
......@@ -108,4 +110,22 @@ void AVirtualRealityPawn::OnEndGrab(const FInputActionValue& Value)
UE_LOG(LogTemp,Warning,TEXT("EndGrab"));
}
void AVirtualRealityPawn::ToggleNavigationMode(const FInputActionValue& Value)
{
UE_LOG(LogTemp,Warning,TEXT("Toggle nav mode"));
switch (PawnMovement->NavigationMode)
{
case EVRNavigationModes::NAV_FLY:
PawnMovement->NavigationMode = EVRNavigationModes::NAV_WALK;
break;
case EVRNavigationModes::NAV_WALK:
PawnMovement->NavigationMode = EVRNavigationModes::NAV_FLY;
break;
default:
PawnMovement->NavigationMode = EVRNavigationModes::NAV_WALK;
}
}
......@@ -35,6 +35,9 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
UInputAction* Turn;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
UInputAction* ToggleNavigationMode;
};
......@@ -69,6 +69,9 @@ protected:
UFUNCTION(BlueprintCallable, Category = "Pawn|Interaction")
void OnEndGrab(const FInputActionValue& Value);
UFUNCTION(BlueprintCallable)
void ToggleNavigationMode(const FInputActionValue& Value);
/* Input */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pawn|Input")
class UInputMappingContext* IMCBase;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment