correct the hand mesh yaw rotation inside the sgpawn after the squat/sgvect3d changes

This commit is contained in:
Mamadou Babaei
2024-03-22 21:03:56 +01:00
parent 092a66ca32
commit d5a7d1d139
13 changed files with 30 additions and 24 deletions
@@ -50,6 +50,8 @@
#include "SenseGlove/Components/SGWristTrackerComponent.h"
#include "SGLog/SGLog.h"
static constexpr float SG_HAND_MESH_YAW_CORRECTION_OFFSET = -90.0f;
struct ASGPawn::FImpl
{
/************************
@@ -201,7 +203,7 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
HandLeft->SetCollisionResponseToChannel(ECC_Destructible, ECR_Block);
HandLeft->SetRight(false);
HandLeft->SetHiddenIfNoGloveDetected(true);
HandLeft->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
HandLeft->SetRelativeRotation(FRotator{0.0f, SG_HAND_MESH_YAW_CORRECTION_OFFSET, 0.0f},
false, nullptr, ETeleportType::None);
HandLeft->SetRelativeLocation(FVector{30.0f, -20.0f, -10.0f},
false, nullptr, ETeleportType::None);
@@ -225,7 +227,7 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RealHandLeft->SetRight(false);
Pimpl->SetVisibility(RealHandLeft, false);
RealHandLeft->SetHiddenIfNoGloveDetected(true);
RealHandLeft->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
RealHandLeft->SetRelativeRotation(FRotator{0.0f, SG_HAND_MESH_YAW_CORRECTION_OFFSET, 0.0f},
false, nullptr, ETeleportType::None);
RealHandLeft->SetRelativeLocation(FVector{30.0f, -20.0f, -10.0f},
false, nullptr, ETeleportType::None);
@@ -428,7 +430,7 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
HandRight->SetCollisionResponseToChannel(ECC_Destructible, ECR_Block);
HandRight->SetRight(true);
HandRight->SetHiddenIfNoGloveDetected(true);
HandRight->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
HandRight->SetRelativeRotation(FRotator{0.0f, SG_HAND_MESH_YAW_CORRECTION_OFFSET, 0.0f},
false, nullptr, ETeleportType::None);
HandRight->SetRelativeLocation(FVector{30.0f, 20.0f, -10.0f},
false, nullptr, ETeleportType::None);
@@ -452,7 +454,7 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RealHandRight->SetRight(true);
Pimpl->SetVisibility(RealHandRight, false);
RealHandRight->SetHiddenIfNoGloveDetected(true);
RealHandRight->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
RealHandRight->SetRelativeRotation(FRotator{0.0f, SG_HAND_MESH_YAW_CORRECTION_OFFSET, 0.0f},
false, nullptr, ETeleportType::None);
RealHandRight->SetRelativeLocation(FVector{30.0f, 20.0f, -10.0f},
false, nullptr, ETeleportType::None);
@@ -1829,20 +1831,24 @@ void ASGPawn::FImpl::UpdateHandRotation(const bool bRight, const FRotator& Rotat
void ASGPawn::FImpl::UpdateLeftHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand)
{
static const FQuat Offset{FQuat::MakeFromEuler(FVector{0.0f, 0.0f, SG_HAND_MESH_YAW_CORRECTION_OFFSET})};
const FQuat NewRotation{Rotation.Quaternion() * Offset};
if (bUpdateVirtualHand)
{
Owner->HandLeft->SetWorldRotation(Rotation);
Owner->HandLeft->SetWorldRotation(NewRotation);
}
Owner->RealHandLeft->SetWorldRotation(Rotation);
Owner->RealHandLeft->SetWorldRotation(NewRotation);
}
void ASGPawn::FImpl::UpdateRightHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand)
{
static const FQuat Offset{FQuat::MakeFromEuler(FVector{0.0f, 0.0f, SG_HAND_MESH_YAW_CORRECTION_OFFSET})};
const FQuat NewRotation{Rotation.Quaternion() * Offset};
if (bUpdateVirtualHand)
{
Owner->HandRight->SetWorldRotation(Rotation);
Owner->HandRight->SetWorldRotation(NewRotation);
}
Owner->RealHandRight->SetWorldRotation(Rotation);
Owner->RealHandRight->SetWorldRotation(NewRotation);
}
void ASGPawn::FImpl::UpdateHandLocationAndRotation(
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.