diff --git a/Content/BP_VirtualRealityPawn.uasset b/Content/BP_VirtualRealityPawn.uasset index 57db298b94dd29a724a4621be5985db121929de2..43908f9622b8ce89155e66ac4f593e1aad5fb529 100644 Binary files a/Content/BP_VirtualRealityPawn.uasset and b/Content/BP_VirtualRealityPawn.uasset differ diff --git a/Content/RWTHVRGameMode.uasset b/Content/RWTHVRGameMode.uasset index 6653bd71a4322c9dcbc3ea7233778864a82def5a..bbe367b340d7b98310000099bb7ffa8e3e088b0f 100644 Binary files a/Content/RWTHVRGameMode.uasset and b/Content/RWTHVRGameMode.uasset differ diff --git a/Source/RWTHVRToolkit/Private/Pawn/ContinuousMovementComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/ContinuousMovementComponent.cpp index af46f80934f02d316a5680f35a1a0a684c809cd3..b7abc5bec979d375f8f13f9e4178f8132de87605 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/ContinuousMovementComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/ContinuousMovementComponent.cpp @@ -102,8 +102,8 @@ void UContinuousMovementComponent::OnBeginMove(const FInputActionValue& Value) const bool bGazeDirected = UVirtualRealityUtilities::IsDesktopMode() || SteeringMode == EVRSteeringModes::STEER_GAZE_DIRECTED; - const FVector ForwardDir = bGazeDirected ? VRPawn->Head->GetForwardVector() : MovementHand->GetForwardVector(); - const FVector RightDir = bGazeDirected ? VRPawn->Head->GetRightVector() : MovementHand->GetRightVector(); + const FVector ForwardDir = bGazeDirected ? VRPawn->HeadCameraComponent->GetForwardVector() : MovementHand->GetForwardVector(); + const FVector RightDir = bGazeDirected ? VRPawn->HeadCameraComponent->GetRightVector() : MovementHand->GetRightVector(); if (VRPawn->Controller != nullptr) { @@ -169,7 +169,7 @@ void UContinuousMovementComponent::SetCameraOffset() const FVector Location; FRotator Rotation; VRPawn->GetActorEyesViewPoint(Location, Rotation); - VRPawn->CameraComponent->SetWorldLocationAndRotation(Location, Rotation); + VRPawn->HeadCameraComponent->SetWorldLocationAndRotation(Location, Rotation); } void UContinuousMovementComponent::UpdateRightHandForDesktopInteraction() diff --git a/Source/RWTHVRToolkit/Private/Pawn/TeleportationComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/TeleportationComponent.cpp index b775efcac63506828c7112e3675cad196a652ce5..99e1fc16b6c918e1c18ef35661f66653c4aae159 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/TeleportationComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/TeleportationComponent.cpp @@ -273,7 +273,7 @@ void UTeleportationComponent::SetCameraOffset() const FVector Location; FRotator Rotation; VRPawn->GetActorEyesViewPoint(Location, Rotation); - VRPawn->CameraComponent->SetWorldLocationAndRotation(Location, Rotation); + VRPawn->HeadCameraComponent->SetWorldLocationAndRotation(Location, Rotation); } void UTeleportationComponent::UpdateRightHandForDesktopInteraction() diff --git a/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp b/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp index 40b293ecdbc5da4bbf250bb32bafd97986000a4a..1d6ac46295f055d38c206a6757c0e0771d8fe103 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp @@ -85,7 +85,7 @@ void UVRPawnMovement::SetHeadComponent(USceneComponent* NewHeadComponent) CapsuleColliderComponent->SetupAttachment(HeadComponent); const float HalfHeight = 80.0f; //this is just an initial value to look good in editor CapsuleColliderComponent->SetCapsuleSize(CapsuleRadius, HalfHeight); - CapsuleColliderComponent->SetWorldLocation(FVector(0.0f, 0.0f,HalfHeight)); + CapsuleColliderComponent->SetWorldLocation(FVector(0.0f, 0.0f,-HalfHeight)); } void UVRPawnMovement::SetCapsuleColliderToUserSize() diff --git a/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp index 0cdd604a8af4c2fb856b490a63b3f0d4e1d175e7..a33be50e47ff4ccfdbcdf2687f0a9bb89532f3e0 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp @@ -23,17 +23,13 @@ AVirtualRealityPawn::AVirtualRealityPawn(const FObjectInitializer& ObjectInitial SetRootComponent(CreateDefaultSubobject<USceneComponent>(TEXT("Origin"))); - CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera")); - CameraComponent->SetupAttachment(RootComponent); - CameraComponent->SetRelativeLocation(FVector(0.0f, 0.0f, BaseEyeHeight)); //so it is rendered correctly in editor - - Head = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("Head MCC")); - Head->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f)); - Head->SetupAttachment(CameraComponent); + HeadCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera")); + HeadCameraComponent->SetupAttachment(RootComponent); + HeadCameraComponent->SetRelativeLocation(FVector(0.0f, 0.0f, BaseEyeHeight)); //so it is rendered correctly in editor PawnMovement = CreateDefaultSubobject<UVRPawnMovement>(TEXT("Pawn Movement")); PawnMovement->SetUpdatedComponent(RootComponent); - PawnMovement->SetHeadComponent(Head); + PawnMovement->SetHeadComponent(HeadCameraComponent); RightHand = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("Right Hand MCC")); RightHand->SetupAttachment(RootComponent); diff --git a/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h b/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h index 58d1b277f0bd11f6988f6ef9046db3ea97d02667..d9672109749907d732e95384f4e97a8c01853818 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h +++ b/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h @@ -22,14 +22,10 @@ class RWTHVRTOOLKIT_API AVirtualRealityPawn : public APawn public: AVirtualRealityPawn(const FObjectInitializer& ObjectInitializer); - /* Proxy */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|Proxy Objects") - UMotionControllerComponent* Head; - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|Proxy Objects") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|MotionControllers") UMotionControllerComponent* RightHand; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|Proxy Objects") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|MotionControllers") UMotionControllerComponent* LeftHand; /* Interaction */ @@ -42,7 +38,7 @@ public: /* CameraComponent */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|Camera") - UCameraComponent* CameraComponent; + UCameraComponent* HeadCameraComponent; protected: