diff --git a/Content/CalPawnInspectionAnimBP.uasset b/Content/CalPawnInspectionAnimBP.uasset
index 14d800ee1c1251a595805b8cf53f51e05f23f704..36b81f61ff101cb2e90c87dc2348f4036036807e 100644
--- a/Content/CalPawnInspectionAnimBP.uasset
+++ b/Content/CalPawnInspectionAnimBP.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:dfe3f3ed131417a49d75cf3c536bae939e96a00ece120b38efb17324adb9b99b
-size 474943
+oid sha256:a7e27800bdb70b16e55eba176228c9d8ab39cdc26170dd2550de7c4d4d02599e
+size 506828
diff --git a/Content/CalibrationGameMap.umap b/Content/CalibrationGameMap.umap
index 7c9508f94599e4fc3626dae4735f5c83ac43b609..028639ebbac1c30cf8cc19b59d225de265efa12c 100644
--- a/Content/CalibrationGameMap.umap
+++ b/Content/CalibrationGameMap.umap
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:659ef9fd34e13e7d7b3c6e057b7476c2c5317344467b482a1ffdba7d223ad56d
-size 435532
+oid sha256:047838abbe441e627a8e0761367e31d50f4db6182cd3855ff52375925e5c47f5
+size 501332
diff --git a/Content/GameCalPawn.uasset b/Content/GameCalPawn.uasset
index 9b2bec6bd09402e5779b3e47718fa268b12323ba..f16ba42e0f33d8e15ec27ccc3a9efd7d895cae92 100644
--- a/Content/GameCalPawn.uasset
+++ b/Content/GameCalPawn.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:ed0e521fd18c61d59f45e0dfd599ef17f71ac828d5203cc1e40faa2a29c5ade4
-size 406452
+oid sha256:0793530b27ba6880b6f90fc5d82bed8340d9e36c2dc8a007e9f34fa7351d734a
+size 462874
diff --git a/Content/IK_CC3.uasset b/Content/IK_CC3.uasset
index 5ec9ca1891687fdc6b30a6c328ac4d12955be9af..7cd2221f970a051e24607427730747350be57727 100644
--- a/Content/IK_CC3.uasset
+++ b/Content/IK_CC3.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:63202b09a6d0196e575957c6bca974f1637b806da297c94e3721a9083366cb1c
-size 3458018
+oid sha256:37f704e3f2812271386c0e452b3b241590acc3d750672c555e8807103923e433
+size 4126155
diff --git a/Content/StartMap.umap b/Content/StartMap.umap
index 39612894a34eb760f0ae16df651f9c30dda7f705..8846dfc729ee2d3c45459884130ed2e0cbb6f72f 100644
--- a/Content/StartMap.umap
+++ b/Content/StartMap.umap
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:d2adcb0a70eab0e6e86fca0525c7231bf6602d495c2311fcc73fcf4ad62e44ba
-size 26476
+oid sha256:de61dd2f6d51bbb4d6172c9b9b2ff168cdc79f639ac08d3695aeaf3d8efe4954
+size 27609
diff --git a/Content/TestHuman.uasset b/Content/TestHuman.uasset
index af2cbc231c289db64e7f7061865bf16c130629d4..5d25afcabea01ef0abb540eae59b4cdc18d38cda 100644
--- a/Content/TestHuman.uasset
+++ b/Content/TestHuman.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:63d3c7579c6e4220e4593149a98de4fdda92f5285b31821f5eaf98d4c437ec0e
-size 171155
+oid sha256:7645e91f1e4ecb8981b7e2d0febd709e22275f2ea7e5060763c5bdd1f3167ccc
+size 176004
diff --git a/Source/AvatarPlugin/Private/AvatarCalibration.cpp b/Source/AvatarPlugin/Private/AvatarCalibration.cpp
index 0a929b7b8102511134a96170f200ea5684bfc7a3..a599e9a061837af50baf6d2fd5b6ae4f44683068 100644
--- a/Source/AvatarPlugin/Private/AvatarCalibration.cpp
+++ b/Source/AvatarPlugin/Private/AvatarCalibration.cpp
@@ -14,7 +14,7 @@ void UAvatarCalibration::OnRightThumbstickClick()
if (calibrationMode == CalibrationMode::GAME)
{
UWorld* World = GetWorld();
- if (World)
+ if (World && false)
{
float ArmLength = 0;
@@ -34,7 +34,7 @@ void UAvatarCalibration::OnLeftThumbstickClick()
if (calibrationMode == CalibrationMode::GAME)
{
UWorld* World = GetWorld();
- if (World)
+ if (World && false)
{
float height;
@@ -176,6 +176,7 @@ void UAvatarCalibration::BeginPlay() {
if (UseCalibrationGame)
{
calibrationMode = CalibrationMode::GAME;
+
}
else
@@ -216,6 +217,8 @@ void UAvatarCalibration::BeginPlay() {
LevelArray.Add(Finish);
CurrentLevelIndex = 0;
+
+
}
measurements->Init();
@@ -246,7 +249,7 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
}
}
else {
-
+
APlayerController* playerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
if (playerController != nullptr) {
leftTriggerPressed = playerController->IsInputKeyDown(EKeys::OculusTouch_Left_Trigger_Click)
@@ -265,6 +268,85 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
//This section controls the level progression and the respective conditions for advancing when the gamified process is selected
if(calibrationMode == CalibrationMode::GAME)
{
+ TicksSinceLevelLoad++;
+ FVector HMDPos = pawn->VRCamera->GetComponentLocation();
+ FVector HMDForwardPos = HMDPos + pawn->VRCamera->GetForwardVector() * 30;
+ FVector HMDRightPos = HMDPos + pawn->VRCamera->GetRightVector() * 30;
+ FVector HMDDownPos = HMDPos; HMDDownPos.Z = HMDDownPos.Z - 20; //instead of taking the negative up vector, select third point on the Z axis to make plane orthogonal to ground. Otherwise its vertical orientation would change with forward/sideway head tilting
+
+ FVector HMDPos1 = pose.HMDPos;
+ FVector HMDX1 = HMDPos1 + pawn->VRCamera->GetForwardVector() * 30;
+ FVector HMDY1 = HMDPos1;
+ //instead of taking the negative up vector, select third point on the Z axis to make plane orthogonal to ground. Otherwise its orientation would change with forwards head tilting
+ HMDY1.Z = HMDY1.Z - 20;
+ FPlane FrontBackPlane1 = FPlane(HMDPos1, HMDX1, HMDY1);
+ //create two plane which intersect the placer from front to back and left to right respectively
+ FPlane FrontBackPlane = FPlane(HMDPos, HMDForwardPos, HMDDownPos);
+ FPlane ShoulderPlane = FPlane(HMDPos, HMDRightPos, HMDDownPos);
+
+
+ float PointPlaneDistanceLeft1 = FVector::PointPlaneDist(pawn->MC_LeftHand->GetComponentLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal());
+ float PointPlaneDistanceRight1 = FVector::PointPlaneDist(pawn->MC_RightHand->GetComponentLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal());
+ FString Distances = "Left " + FString::SanitizeFloat(PointPlaneDistanceLeft1) + "\n Right: " + FString::SanitizeFloat(PointPlaneDistanceRight1);
+ TextWall->GetTextRender()->SetText(FText::FromString(Distances));
+
+
+
+ if(!wereControllersChecked && TicksSinceLevelLoad >= 10)
+ {
+ UE_LOG(LogTemp, Warning, TEXT("Were Controllers Checked"));
+ // Check if the controllers are swapped or not by getting the distance of the controllers to the frontback plane
+ float DistLeftHand = FVector::PointPlaneDist(pawn->MC_LeftHand->GetComponentLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal());
+ float DistRightHand = FVector::PointPlaneDist(pawn->MC_RightHand->GetComponentLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal());
+ if (DistLeftHand > 0 && DistRightHand < 0)
+ {
+ UE_LOG(LogTemp, Warning, TEXT("Calling Switch Hand Tracking Sources"));
+ pawn->SwitchHandTrackingSources(); //change the actual tracking sources
+ pawn->SwapVisibleHands(); //change the visual hand representation
+ handsSwitched = true;
+ }
+
+ //same for the foot tracking sources if present
+ if (useFootControllers)
+ {
+ if (FVector::PointPlaneDist(pawn->MC_LeftFoot->GetComponentLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal()) > 0 &&
+ FVector::PointPlaneDist(pawn->MC_RightFoot->GetComponentLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal()) < 0)
+ {
+ pawn->SwitchFootTrackingSources();
+ feetSwitched = true;
+ }
+
+ }
+ wereControllersChecked = true;
+ }
+
+
+
+ //Debug Corner
+ if (MsgDelay >= 60)
+ {
+ //UE_LOG(LogTemp, Warning, TEXT("UpdateCalibration()"));
+ UWorld* World = GetWorld();
+ //DrawDebugSphere(World, pose.HipControllerPos, 5, 30, FColor::Blue, false, 1);
+ DrawDebugSphere(World, pose.LeftShoulderPos, 6, 30, FColor::Green, false, 1);
+ DrawDebugSphere(World, pose.RightShoulderPos, 6, 30, FColor::Red, false, 1);
+ DrawDebugSphere(World, pose.LeftHandPos, 6, 30, FColor::Green, false, 1);
+ DrawDebugSphere(World, pose.RightHandPos, 6, 30, FColor::Red, false, 1);
+ //DrawDebugSphere(World, pose.LeftFootPos, 5, 30, FColor::Green, false, 1);
+ //DrawDebugSphere(World, pose.RightFootPos, 5, 30, FColor::Red, false, 1);
+ //FVector HipUpPos = pose.HipControllerRot.Quaternion().GetUpVector() * 1;
+ //DrawDebugDirectionalArrow(World, pose.HipControllerPos, HipUpPos, 6, FColor::Magenta, false, 1);
+
+ //create plane which intersects the player front to back
+
+
+
+ //DrawDebugSolidPlane(World, FrontBackPlane, HMDPos, 100, FColor::Magenta, false, 2);
+ //DrawDebugSolidPlane(World, ShoulderPlane, HMDPos, 100, FColor::Emerald, false, 2);
+
+ }
+
+ //TODO fix rumbling
//Progress/Rumbling functionality in the game state. Activates if the current stage requires input
if (LevelArray[CurrentLevelIndex].inputRequired)
{
@@ -293,7 +375,7 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
pawn->SetActorLocation(WelcomePosition->GetActorLocation() + WelcomePosition->GetActorUpVector() * 55);
LevelArray[0].isStarted = true;
- }
+ }
AActor* AttachedActorLeft = LeftShoulderSphere->GetAttachParentActor();
AActor* AttachedActorRight = RightShoulderSphere->GetAttachParentActor();
@@ -315,20 +397,7 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
LeftShoulderSphere->SetActorLocation(LeftShoulderLocation);
RightShoulderSphere->SetActorLocation(RightShoulderLocation);
-
-
-
- //TODO create plane that intersects the center of the player from left to right. Snap shoulders to that plane
-
- //PLANE
- FVector HMDPos = pose.HMDPos;
- FVector HMDX = HMDPos + pawn->VRCamera->GetRightVector() * 30;
- FVector HMDY = HMDPos;
- //instead of taking the negative up vector, select third point on the Z axis to make plane orthogonal to ground. Otherwise its orientation would change with forwards head tilting
- HMDY.Z = HMDY.Z - 20;
-
- FPlane ShoulderPlane = FPlane(HMDPos, HMDX, HMDY);
-
+ //create plane that intersects the center of the player from left to right. Snap shoulders to that plane
//calculate the shoulder spheres distance to the plane
float DistanceLeftShoulderToPlane = FVector::PointPlaneDist(LeftShoulderSphere->GetActorLocation(), ShoulderPlane.GetOrigin(), ShoulderPlane.GetNormal());
float DistanceRightShoulderToPlane = FVector::PointPlaneDist(RightShoulderSphere->GetActorLocation(), ShoulderPlane.GetOrigin(), ShoulderPlane.GetNormal());
@@ -336,10 +405,7 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
//Set Sphere Locations to have their centers in the plane. Ensures that the shoulder spheres have the same "depth"
FVector LeftCorrected = LeftShoulderSphere->GetActorLocation() - (DistanceLeftShoulderToPlane * ShoulderPlane.GetNormal());
FVector RightCorrected = RightShoulderSphere->GetActorLocation() - (DistanceRightShoulderToPlane * ShoulderPlane.GetNormal());
-
-
-
-
+
LeftShoulderSphere->SetActorLocation(LeftCorrected);
RightShoulderSphere->SetActorLocation(RightCorrected);
@@ -360,17 +426,31 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
LeftCorrected = LeftCorrected - (pawn->VRCamera->GetRightVector() * MeanShoulderDistance);
RightCorrected = RightCorrected + (pawn->VRCamera->GetRightVector() * MeanShoulderDistance);
//apply offset to move shoulders a little back
- float ShoulderOffset = 20;
+ float ShoulderOffset = 5;
LeftCorrected = LeftCorrected + ShoulderPlane.GetNormal() * ShoulderOffset;
RightCorrected = RightCorrected + ShoulderPlane.GetNormal() * ShoulderOffset;
LeftShoulderSphere->SetActorLocation(LeftCorrected);
RightShoulderSphere->SetActorLocation(RightCorrected);
+
+ //check whether the spheres have been attached mirrored (left sphere to right shoulder)
+
+
+
+ //If the distance between the Left shoudler sphere and the plane is negative, the spheres are places mirrored and need their location swapped
+ if (FVector::PointPlaneDist(LeftShoulderSphere->GetActorLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal()) > 0 ||
+ FVector::PointPlaneDist(RightShoulderSphere->GetActorLocation(), FrontBackPlane.GetOrigin(), FrontBackPlane.GetNormal()) < 0)
+ {
+
+ //first swap the physical locations of the spheres
+ FVector OldLeftPos = LeftShoulderSphere->GetActorLocation();
+ LeftShoulderSphere->SetActorLocation(RightShoulderSphere->GetActorLocation());
+ RightShoulderSphere->SetActorLocation(OldLeftPos);
+
+ }
ShouldersAdjusted = true;
LevelArray[0].inputRequired = true; //unlocks progression through trigger presses
}
-
-
//proceed when both shoulders are attached and
if (TicksWithBothTriggersPressed >=30)
{
@@ -378,10 +458,8 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
LevelArray[0].isFinished = true;
LevelArray[0].inputRequired = false;
CurrentLevelIndex = 1;
-
//Setting Mirror Parameters
- MirrorMoveDistance = 230;
-
+ MirrorMoveDistance = 230;
}
}
else
@@ -531,12 +609,14 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
}
void UAvatarCalibration::UpdateCalibration() {
- if (MsgDelay >= 60)
- {
- //UE_LOG(LogTemp, Warning, TEXT("UpdateCalibration()"));
- UWorld* World = GetWorld();
- //DrawDebugSphere(World, pose.HipControllerPos, 5, 30, FColor::Blue, false, 1);
- }
+ //if (MsgDelay >= 60)
+ //{
+ // //UE_LOG(LogTemp, Warning, TEXT("UpdateCalibration()"));
+ // UWorld* World = GetWorld();
+ // DrawDebugSphere(World, pose.HipControllerPos, 5, 30, FColor::Blue, false, 1);
+ // DrawDebugSphere(World, pose.LeftShoulderPos, 5, 5, FColor::Green, false, 1);
+ // DrawDebugSphere(World, pose.RightShoulderPos, 5, 5, FColor::Red, false, 1);
+ //}
if (calibrationMode == CalibrationMode::GAME)
{
@@ -567,6 +647,7 @@ void UAvatarCalibration::UpdateCalibration() {
UWorld* World = GetWorld();
//DrawDebugSphere(World, pose.LeftFootPos, 5, 5, FColor::Green, false, 1);
//DrawDebugSphere(World, pose.RightFootPos, 5, 5, FColor::Red, false, 1);
+
}
}
@@ -577,7 +658,8 @@ void UAvatarCalibration::UpdateCalibration() {
float Height = FMath::Abs(pose.HMDPos.Z - pawn->GetVROriginWorldLocation().Z);
FString HeightText = FString::SanitizeFloat(Height);
- TextWall->GetTextRender()->SetText(FText::FromString(HeightText));
+ //TextWall->GetTextRender()->SetText(FText::FromString(HeightText));
+
}
//UPPER BODY STAGE (Index = 1)
if (CurrentLevelIndex == 1)
@@ -965,10 +1047,6 @@ void UAvatarCalibration::GoToNextStage()
}
}
-void UAvatarCalibration::FinishCurrentLevel()
-{
- LevelArray[CurrentLevelIndex].isFinished = true;
-}
float UAvatarCalibration::GetConfirmTimePercentage() {
return (pawn->GetGameTimeSinceCreation() - triggerPressStartTime) / confirmTime;
@@ -1044,7 +1122,9 @@ void UAvatarCalibration::OnLevelLoaded() {
for (AActor* actor : streamingLevel->GetLoadedLevel()->Actors) {
if (actor->GetName().Contains("CalPawn", ESearchCase::CaseSensitive)) {
+
pawn = Cast<ACalibrationPawn>(actor);
+
}
else if (actor->GetName().Contains("HenryCapture", ESearchCase::CaseSensitive)) {
@@ -1116,6 +1196,9 @@ void UAvatarCalibration::OnLevelLoaded() {
}
LeftShoulderStartPos = LeftShoulderSphere->GetActorLocation();
RightShoulderStartPos = RightShoulderSphere->GetActorLocation();
+
+
+
}
@@ -1143,7 +1226,7 @@ void UAvatarCalibration::OnLevelLoaded() {
//sets the AvatarCalibrationComponent of the newly posessed pawn to this in order to collect all necessary data which can later be passed onto future pawns
pawn->SetCalibrationComponent(this);
//Subscribe to changes made in the game level
- pawn->LevelStateChanged.BindUObject(this, &UAvatarCalibration::FinishCurrentLevel);
+ //pawn->LevelStateChanged.BindUObject(this, &UAvatarCalibration::FinishCurrentLevel);
if (helperPawn != nullptr) {
if (calibrationMode == CalibrationMode::AVATARGUIDE) {
@@ -1171,12 +1254,17 @@ void UAvatarCalibration::OnLevelLoaded() {
leftFootSphere->SetActorHiddenInGame(true);
rightFootSphere->SetActorHiddenInGame(true);
}
+
+
}
void UAvatarCalibration::StartInspection() {
isInspecting = true;
if(calibrationMode == CalibrationMode::GAME)
{
+ if (pawn->isCalibrationFinished == false) {
+ pawn->isCalibrationFinished = true;
+ }
//teleport pawn to finish location
//pawn->SetActorLocation(FinishPosition->GetActorLocation() + FinishPosition->GetActorUpVector() * 50);
//remove artifacts of the calibration process
diff --git a/Source/AvatarPlugin/Private/CalibrationPawn.cpp b/Source/AvatarPlugin/Private/CalibrationPawn.cpp
index 4ba2413180fd391132c9871738787117eb1ce56e..83241db51c899b34b32856d58a8a3ad4f3f4ade2 100644
--- a/Source/AvatarPlugin/Private/CalibrationPawn.cpp
+++ b/Source/AvatarPlugin/Private/CalibrationPawn.cpp
@@ -276,12 +276,7 @@ void ACalibrationPawn::RumbleController(EControllerHand which, bool stop) {
else {
pc->PlayHapticEffect(rumbleCurve, which, 1.0f, true);
}
-
}
-void ACalibrationPawn::LevelFinished()
-{
- UE_LOG(LogTemp, Warning, TEXT("Calling LevelFinished"));
- LevelStateChanged.ExecuteIfBound();
-}
+
diff --git a/Source/AvatarPlugin/Private/Measurements.cpp b/Source/AvatarPlugin/Private/Measurements.cpp
index 9c8b4f23fe3ebf30a63268b15e6ea8a028ac4adb..96b77ebb316215a8e6cf582576aba89af811aa61 100644
--- a/Source/AvatarPlugin/Private/Measurements.cpp
+++ b/Source/AvatarPlugin/Private/Measurements.cpp
@@ -34,7 +34,7 @@ void UMeasurements::TakeGameMeasures(int StageIndex, const FVRPose& pose, float
calcedAppliedLengths = false;
FMeasurement HipMeasure;
FMeasurement KneeMeasure;
-
+ FMeasurement HeightMeasure;
if (StageIndex == 1)
{
@@ -60,12 +60,7 @@ void UMeasurements::TakeGameMeasures(int StageIndex, const FVRPose& pose, float
{
Measure.measuredLength = FVector::Distance(pose.RightShoulderPos, pose.LeftShoulderPos);
}
- if (Measure.enumName == MeasurementName::HEIGHT)
- {
- //TODO Check influence of LeftFootPos
- float HeightOffset = 0;
- Measure.measuredLength = FMath::Abs(pose.HMDPos.Z - pose.LeftFootPos.Z) + HeightOffset;
- }
+
}
}
@@ -74,24 +69,24 @@ void UMeasurements::TakeGameMeasures(int StageIndex, const FVRPose& pose, float
float FloorHeight = Value;
if (useHipController)
{
-
+ UE_LOG(LogTemp, Warning, TEXT("3: Measuring Hip without controller"));
//hip height
HipMeasure.measuredAdditionalHeight = FMath::Abs(FloorHeight - pose.HipControllerPos.Z);
//Hip width TODO try to find fitting hip width without additional measuring steps
- HipMeasure.measuredLength = 25.f;
+ HipMeasure.measuredLength = 26.f;
+
+ KneeMeasure.measuredLength = (pose.HipControllerPos - pose.LeftFootPos).Size() * 0.5;
- KneeMeasure.measuredAdditionalHeight = (pose.HipControllerPos - pose.LeftFootPos).Size() * 0.5;
}
if (!useHipController)
{
- UE_LOG(LogTemp, Warning, TEXT("3: Measuring Hip without controller"));
+ UE_LOG(LogTemp, Warning, TEXT("3: Measuring Hip without controller NEW"));
UE_LOG(LogTemp, Warning, TEXT(" FloorHeight = %f"), FloorHeight);
//get distance from hand controller to floor
float DistanceToFloor = FMath::Abs(FloorHeight - pose.RightHandPos.Z);
- UE_LOG(LogTemp, Warning, TEXT(" DistanceToFloor = %f"), DistanceToFloor)
- ;
+ UE_LOG(LogTemp, Warning, TEXT(" DistanceToFloor = %f"), DistanceToFloor);
HipMeasure.measuredLength = (pose.RightHandPos - pose.LeftHandPos).Size();
UE_LOG(LogTemp, Warning, TEXT(" HipMeasure.measuredLength = %f"), HipMeasure.measuredLength);
@@ -102,6 +97,8 @@ void UMeasurements::TakeGameMeasures(int StageIndex, const FVRPose& pose, float
UE_LOG(LogTemp, Warning, TEXT("KneeMeasure.measuredAdditionalHeight = %f"), KneeMeasure.measuredLength);
}
+ float DistanceHMDFloor = FMath::Abs(FloorHeight - pose.HMDPos.Z);
+ HeightMeasure.measuredLength = DistanceHMDFloor;
for (auto& Measure : measurements)
{
@@ -114,6 +111,11 @@ void UMeasurements::TakeGameMeasures(int StageIndex, const FVRPose& pose, float
if (Measure.enumName == MeasurementName::KNEE)
{
Measure.measuredLength = KneeMeasure.measuredLength;
+
+ }
+ if (Measure.enumName == MeasurementName::HEIGHT)
+ {
+ Measure.measuredLength = HeightMeasure.measuredLength;
}
}
}
@@ -304,8 +306,6 @@ void UMeasurements::CalcAppliedLengths(AVirtualHuman* virtualHuman) {
hip_height = measurement.measuredAdditionalHeight;
UE_LOG(LogTemp, Warning, TEXT("hip_width = %f"), hip_width);
UE_LOG(LogTemp, Warning, TEXT("hip_height = %f"), hip_height);
-
-
break;
case MeasurementName::KNEE:
knee_height = measurement.measuredLength;
diff --git a/Source/AvatarPlugin/Public/AvatarCalibration.h b/Source/AvatarPlugin/Public/AvatarCalibration.h
index cb7ef8e75f5c256fc5d4d7196b5aad4d648da9a1..d603daa555ca848040ced160f9b4d093a2da1828 100644
--- a/Source/AvatarPlugin/Public/AvatarCalibration.h
+++ b/Source/AvatarPlugin/Public/AvatarCalibration.h
@@ -176,6 +176,8 @@ private:
UPROPERTY() AActor* FinishPosition = nullptr;
UPROPERTY() ATextRenderActor* TextWall = nullptr;
UPROPERTY() AStaticMeshActor* Mirror = nullptr;
+ UPROPERTY() UStaticMeshComponent* HMDVisual = nullptr;
+
UPROPERTY() AActor* LeftShoulderSphere = nullptr;
UPROPERTY() AActor* RightShoulderSphere = nullptr;
@@ -187,6 +189,11 @@ private:
UPROPERTY() int CurrentLevelIndex = 0;
UPROPERTY() bool isCurrentLevelFinished = true;
+ //parameters for controller switch check
+ UPROPERTY() bool wereControllersChecked = false; //check flag for the first tick after level load
+ UPROPERTY() int TicksSinceLevelLoad = 0;
+
+
UPROPERTY() int MinTriggerPressTicks = 100;
UPROPERTY() int CurrentTriggerPressTicks = 0;
@@ -247,9 +254,6 @@ public:
UFUNCTION(BlueprintCallable)
void GoToNextStage();
- UFUNCTION(BlueprintCallable)
- void FinishCurrentLevel();
-
diff --git a/Source/AvatarPlugin/Public/CalibrationPawn.h b/Source/AvatarPlugin/Public/CalibrationPawn.h
index 9625d63de1c0d7e3b7a651c14180aa768948a096..dfe20e2a8130c0278965a7a119ad2193d397bb52 100644
--- a/Source/AvatarPlugin/Public/CalibrationPawn.h
+++ b/Source/AvatarPlugin/Public/CalibrationPawn.h
@@ -82,19 +82,16 @@ public:
void RumbleController(EControllerHand which, bool stop);
- //additions for the gamified calibration process
- UFUNCTION(BlueprintCallable)
- void LevelFinished();
- void FinishCalibration();
+
+ UPROPERTY(BlueprintReadWrite) bool isCalibrationFinished = false;
+
//Delegate informing about level progress
DECLARE_DELEGATE(FLevelFinished);
FLevelFinished LevelStateChanged;
- DECLARE_DELEGATE(FCalibrationFinished);
- FCalibrationFinished CalibrationFinished;
-
-
-
+ //picked up in the GameCalPawn blueprint. Does not need an implementation
+ UFUNCTION(BlueprintImplementableEvent) void SwapVisibleHands();
+
};