diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp index 641112a1..832df20d 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp @@ -93,8 +93,10 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) HandLeft->SetupAttachment(GetRootComponent()); HandLeft->SetRight(false); HandLeft->SetHiddenIfNoGloveDetected(true); - HandLeft->SetWorldLocation(FVector{30.0f, -20.0f, -10.0f}, - false, nullptr, ETeleportType::None); + HandLeft->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f}, + false, nullptr, ETeleportType::None); + HandLeft->SetRelativeLocation(FVector{30.0f, -20.0f, -10.0f}, + false, nullptr, ETeleportType::None); WristTrackerRight = ObjectInitializer.CreateDefaultSubobject( this, TEXT("WristTrackerRight")); @@ -105,8 +107,10 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) HandRight->SetupAttachment(GetRootComponent()); HandRight->SetRight(true); HandRight->SetHiddenIfNoGloveDetected(true); - HandRight->SetWorldLocation(FVector{30.0f, 20.0f, -10.0f}, - false, nullptr, ETeleportType::None); + HandRight->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f}, + false, nullptr, ETeleportType::None); + HandRight->SetRelativeLocation(FVector{30.0f, 20.0f, -10.0f}, + false, nullptr, ETeleportType::None); } void ASGPawn::BeginPlay() @@ -159,4 +163,4 @@ ASGPawn::FImpl::~FImpl() = default; void ASGPawn::FImplDeleter::operator()(const FImpl* P) const { delete P; -} +} \ No newline at end of file diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp index f5cf61d9..ee84e7f6 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp @@ -76,6 +76,8 @@ ASGVirtualHandActor::ASGVirtualHandActor(const FObjectInitializer& ObjectInitial VirtualHand = CreateDefaultSubobject(TEXT("VirtualHand")); VirtualHand->SetupAttachment(RootComponent); + VirtualHand->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f}, + false, nullptr, ETeleportType::None); WristTracker = CreateDefaultSubobject(TEXT("WristTracker")); WristTracker->SetupAttachment(RootComponent); diff --git a/Source/SenseGloveUtils/Public/SGUtils/SGAngles.h b/Source/SenseGloveUtils/Public/SGUtils/SGAngles.h index fe086851..fdf67f08 100644 --- a/Source/SenseGloveUtils/Public/SGUtils/SGAngles.h +++ b/Source/SenseGloveUtils/Public/SGUtils/SGAngles.h @@ -55,13 +55,13 @@ public: static FORCEINLINE FVector TransformToSenseGlove(const FVector& Vector) { - return FMath::DegreesToRadians(FVector(Vector.X * -1.0f, Vector.Z, Vector.Y)); + return FMath::DegreesToRadians(FVector(Vector.Y * -1.0f, Vector.X, Vector.Z)); } template static FORCEINLINE V TransformToSenseGlove(const FVector& Vector) { - return FMath::DegreesToRadians(V(Vector.X * -1.0f, Vector.Z, Vector.Y)); + return FMath::DegreesToRadians(V(Vector.Y * -1.0f, Vector.X, Vector.Z)); } static FORCEINLINE float TransformToUnreal(const float Radians) @@ -114,13 +114,13 @@ public: static FORCEINLINE FVector TransformToUnreal(const FVector& Vector) { - return FMath::RadiansToDegrees(FVector(Vector.X * -1.0f, Vector.Z, Vector.Y)); + return FMath::RadiansToDegrees(FVector(Vector.Y * -1.0f, Vector.X, Vector.Z)); } template static FORCEINLINE FVector TransformToUnreal(const V& Vector) { - return FMath::RadiansToDegrees(FVector(Vector.GetX() * -1.0f, Vector.GetZ(), Vector.GetY())); + return FMath::RadiansToDegrees(FVector(Vector.GetY() * -1.0f, Vector.GetX(), Vector.GetZ())); } public: