fix the hand animation implementation and angle conversions to work with the standard ue5.1+ hand from epic

This commit is contained in:
Mamadou Babaei
2023-03-28 18:29:26 +02:00
parent f2ce577a1b
commit 356e850a13
3 changed files with 15 additions and 9 deletions
@@ -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<USGWristTrackerComponent>(
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()
@@ -76,6 +76,8 @@ ASGVirtualHandActor::ASGVirtualHandActor(const FObjectInitializer& ObjectInitial
VirtualHand = CreateDefaultSubobject<USGVirtualHandComponent>(TEXT("VirtualHand"));
VirtualHand->SetupAttachment(RootComponent);
VirtualHand->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
false, nullptr, ETeleportType::None);
WristTracker = CreateDefaultSubobject<USGWristTrackerComponent>(TEXT("WristTracker"));
WristTracker->SetupAttachment(RootComponent);
@@ -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<typename V>
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<typename V>
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: