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

fix nav mode toggle

parent bf6f9f41
No related branches found
No related tags found
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
No preview for this file type
...@@ -41,9 +41,6 @@ void UContinuousMovementComponent::SetupInputActions() ...@@ -41,9 +41,6 @@ void UContinuousMovementComponent::SetupInputActions()
UE_LOG(LogTemp,Error,TEXT("InputSubsystem IS NOT VALID")); UE_LOG(LogTemp,Error,TEXT("InputSubsystem IS NOT VALID"));
return; return;
} }
InputSubsystem->ClearAllMappings();
// add Input Mapping context // add Input Mapping context
InputSubsystem->AddMappingContext(IMCMovement,0); InputSubsystem->AddMappingContext(IMCMovement,0);
...@@ -72,19 +69,19 @@ void UContinuousMovementComponent::SetupInputActions() ...@@ -72,19 +69,19 @@ void UContinuousMovementComponent::SetupInputActions()
APlayerController* PC = Cast<APlayerController>(VRPawn->GetController()); APlayerController* PC = Cast<APlayerController>(VRPawn->GetController());
if (PC) if (PC)
{ {
UE_LOG(LogTemp,Error,TEXT("PC PLAYER CONtroller is valid"));
PC->bShowMouseCursor = true; PC->bShowMouseCursor = true;
PC->bEnableClickEvents = true; PC->bEnableClickEvents = true;
PC->bEnableMouseOverEvents = true; PC->bEnableMouseOverEvents = true;
} else
{
UE_LOG(LogTemp,Error,TEXT("PC Player Controller is invalid"));
} }
EI->BindAction(InputActions->DesktopRotation, ETriggerEvent::Started, this, &UContinuousMovementComponent::StartDesktopRotation); EI->BindAction(InputActions->DesktopRotation, ETriggerEvent::Started, this, &UContinuousMovementComponent::StartDesktopRotation);
EI->BindAction(InputActions->DesktopRotation, ETriggerEvent::Completed, this, &UContinuousMovementComponent::EndDesktopRotation); EI->BindAction(InputActions->DesktopRotation, ETriggerEvent::Completed, this, &UContinuousMovementComponent::EndDesktopRotation);
EI->BindAction(InputActions->MoveUp, ETriggerEvent::Triggered,this,&UContinuousMovementComponent::OnBeginUp); EI->BindAction(InputActions->MoveUp, ETriggerEvent::Triggered,this,&UContinuousMovementComponent::OnBeginUp);
} }
} }
void UContinuousMovementComponent::StartDesktopRotation() void UContinuousMovementComponent::StartDesktopRotation()
{ {
bApplyDesktopRotation = true; bApplyDesktopRotation = true;
...@@ -141,7 +138,7 @@ void UContinuousMovementComponent::OnBeginTurn(const FInputActionValue& Value) ...@@ -141,7 +138,7 @@ void UContinuousMovementComponent::OnBeginTurn(const FInputActionValue& Value)
{ {
if (UVirtualRealityUtilities::IsDesktopMode() && bApplyDesktopRotation) if (UVirtualRealityUtilities::IsDesktopMode() && bApplyDesktopRotation)
{ {
VRPawn->AddControllerPitchInput(TurnRateFactor * TurnValue.Y); VRPawn->AddControllerPitchInput(TurnRateFactor * -TurnValue.Y);
SetCameraOffset(); SetCameraOffset();
} }
} }
...@@ -151,7 +148,6 @@ void UContinuousMovementComponent::OnBeginTurn(const FInputActionValue& Value) ...@@ -151,7 +148,6 @@ void UContinuousMovementComponent::OnBeginTurn(const FInputActionValue& Value)
void UContinuousMovementComponent::OnBeginSnapTurn(const FInputActionValue& Value) void UContinuousMovementComponent::OnBeginSnapTurn(const FInputActionValue& Value)
{ {
const FVector2D TurnValue = Value.Get<FVector2D>(); const FVector2D TurnValue = Value.Get<FVector2D>();
if (TurnValue.X != 0.f) if (TurnValue.X != 0.f)
{ {
VRPawn->AddControllerYawInput(SnapTurnAngle); VRPawn->AddControllerYawInput(SnapTurnAngle);
...@@ -183,8 +179,6 @@ void UContinuousMovementComponent::UpdateRightHandForDesktopInteraction() ...@@ -183,8 +179,6 @@ void UContinuousMovementComponent::UpdateRightHandForDesktopInteraction()
void UContinuousMovementComponent::OnBeginUp(const FInputActionValue& Value) void UContinuousMovementComponent::OnBeginUp(const FInputActionValue& Value)
{ {
const float MoveValue = Value.Get<FVector2D>().X; const float MoveValue = Value.Get<FVector2D>().X;
UE_LOG(LogTemp,Warning,TEXT("MoveUp: %f"),MoveValue);
//the right hand is rotated on desktop to follow the cursor so it's forward is also changing with cursor position //the right hand is rotated on desktop to follow the cursor so it's forward is also changing with cursor position
VRPawn->AddMovementInput(VRPawn->Head->GetUpVector(), MoveValue); VRPawn->AddMovementInput(VRPawn->Head->GetUpVector(), MoveValue);
} }
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "Engine/LocalPlayer.h" #include "Engine/LocalPlayer.h"
#include "GameFramework/PlayerController.h" #include "GameFramework/PlayerController.h"
#include "Pawn/UniversalTrackedComponent.h" #include "Pawn/UniversalTrackedComponent.h"
#include "Utility/VirtualRealityUtilities.h"
#include "EnhancedInputComponent.h" #include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h" #include "EnhancedInputSubsystems.h"
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
......
...@@ -78,7 +78,6 @@ public: ...@@ -78,7 +78,6 @@ public:
private: private:
UPROPERTY() UPROPERTY()
UUniversalTrackedComponent* MovementHand; UUniversalTrackedComponent* MovementHand;
......
...@@ -10,6 +10,13 @@ ...@@ -10,6 +10,13 @@
class UCameraComponent; class UCameraComponent;
class ULiveLinkComponentController; class ULiveLinkComponentController;
/**
* Custom logging for all RWTHToolkit related stuff
*/
/** /**
* *
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment