diff --git a/Source/DisplayClusterExtensions/Private/Pawn/VRPawnMovement.cpp b/Source/DisplayClusterExtensions/Private/Pawn/VRPawnMovement.cpp
index 5cceb96c00fde4c6491cda9c33ac28390e871501..182c2b5ed2fc40f2687bd3cbcfb7459ef26d4862 100644
--- a/Source/DisplayClusterExtensions/Private/Pawn/VRPawnMovement.cpp
+++ b/Source/DisplayClusterExtensions/Private/Pawn/VRPawnMovement.cpp
@@ -42,7 +42,7 @@ void UVRPawnMovement::TickComponent(float DeltaTime, enum ELevelTick TickType, F
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
- LastCameraPosition = CameraComponent->GetComponentLocation();
+ LastHeadPosition = HeadComponent->GetComponentLocation();
}
bool UVRPawnMovement::CheckForVirtualMovCollision(FVector PositionChange, float DeltaTime)
@@ -57,15 +57,15 @@ bool UVRPawnMovement::CheckForVirtualMovCollision(FVector PositionChange, float
return false;
}
-void UVRPawnMovement::SetCameraComponent(UCameraComponent* NewCameraComponent)
+void UVRPawnMovement::SetHeadComponent(USceneComponent* NewHeadComponent)
{
- CameraComponent = NewCameraComponent;
- CapsuleColliderComponent->SetupAttachment(CameraComponent);
+ HeadComponent = NewHeadComponent;
+ CapsuleColliderComponent->SetupAttachment(HeadComponent);
}
void UVRPawnMovement::SetCapsuleColliderToUserSize()
{
- float CharachterSize = abs(UpdatedComponent->GetComponentLocation().Z - CameraComponent->GetComponentLocation().Z);
+ float CharachterSize = abs(UpdatedComponent->GetComponentLocation().Z - HeadComponent->GetComponentLocation().Z);
if (CharachterSize > MaxStepHeight)
{
@@ -81,21 +81,21 @@ void UVRPawnMovement::SetCapsuleColliderToUserSize()
CapsuleColliderComponent->SetCapsuleSize(ColliderRadius, ColliderHalfHeight);
}
- CapsuleColliderComponent->SetWorldLocation(CameraComponent->GetComponentLocation());
+ CapsuleColliderComponent->SetWorldLocation(HeadComponent->GetComponentLocation());
CapsuleColliderComponent->AddWorldOffset(FVector(0, 0, -ColliderHalfHeight));
CapsuleColliderComponent->SetWorldRotation(FRotator(0, 0, 1));
}
else
{
- CapsuleColliderComponent->SetWorldLocation(CameraComponent->GetComponentLocation());
+ CapsuleColliderComponent->SetWorldLocation(HeadComponent->GetComponentLocation());
CapsuleColliderComponent->SetWorldRotation(FRotator(0, 0, 1));
}
}
void UVRPawnMovement::CheckForPhysWalkingCollision()
{
- FVector CurrentCameraPosition = CameraComponent->GetComponentLocation();
- FVector Direction = CurrentCameraPosition - LastCameraPosition;
+ FVector CurrentHeadPosition = HeadComponent->GetComponentLocation();
+ FVector Direction = CurrentHeadPosition - LastHeadPosition;
FHitResult FHitResultPhys;
CapsuleColliderComponent->AddWorldOffset(Direction, true, &FHitResultPhys);
diff --git a/Source/DisplayClusterExtensions/Private/Pawn/VirtualRealityPawn.cpp b/Source/DisplayClusterExtensions/Private/Pawn/VirtualRealityPawn.cpp
index 3a078bd5f53b27d5bc3fee2ad39603edbe821219..de5947b1189bb24008208536e196c61c7e2d1914 100644
--- a/Source/DisplayClusterExtensions/Private/Pawn/VirtualRealityPawn.cpp
+++ b/Source/DisplayClusterExtensions/Private/Pawn/VirtualRealityPawn.cpp
@@ -26,14 +26,14 @@ AVirtualRealityPawn::AVirtualRealityPawn(const FObjectInitializer& ObjectInitial
CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
CameraComponent->SetupAttachment(RootComponent);
CameraComponent->SetAbsolute();
-
- PawnMovement = CreateDefaultSubobject<UVRPawnMovement>(TEXT("Pawn Movement"));
- PawnMovement->SetUpdatedComponent(RootComponent);
- PawnMovement->SetCameraComponent(CameraComponent);
Head = CreateDefaultSubobject<UUniversalTrackedComponent>(TEXT("Head"));
Head->ProxyType = ETrackedComponentType::TCT_HEAD;
Head->SetupAttachment(RootComponent);
+
+ PawnMovement = CreateDefaultSubobject<UVRPawnMovement>(TEXT("Pawn Movement"));
+ PawnMovement->SetUpdatedComponent(RootComponent);
+ PawnMovement->SetHeadComponent(Head);
RightHand = CreateDefaultSubobject<UUniversalTrackedComponent>(TEXT("Right Hand"));
RightHand->ProxyType = ETrackedComponentType::TCT_RIGHT_HAND;
diff --git a/Source/DisplayClusterExtensions/Public/Pawn/VRPawnMovement.h b/Source/DisplayClusterExtensions/Public/Pawn/VRPawnMovement.h
index 0eeee2e3b94195514731d446d5cb499cc790b6cf..31bb8611508c484f62f346789ab9a5c4c654af34 100644
--- a/Source/DisplayClusterExtensions/Public/Pawn/VRPawnMovement.h
+++ b/Source/DisplayClusterExtensions/Public/Pawn/VRPawnMovement.h
@@ -38,7 +38,7 @@ public:
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
- void SetCameraComponent(UCameraComponent* NewCameraComponent);
+ void SetHeadComponent(USceneComponent* NewHeadComponent);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement")
EVRNavigationModes NavigationMode = EVRNavigationModes::NAV_WALK;
@@ -63,8 +63,8 @@ private:
//(direction = Down = -1), (direction = Up = 1)
UPROPERTY() UCapsuleComponent* CapsuleColliderComponent = nullptr;
- UPROPERTY() UCameraComponent* CameraComponent = nullptr;
+ UPROPERTY() USceneComponent* HeadComponent = nullptr;
float VerticalSpeed = 0.0f;
- FVector LastCameraPosition;
+ FVector LastHeadPosition;
};