Skip to content
Snippets Groups Projects
Commit 7958b724 authored by mmeierkrueger's avatar mmeierkrueger :art:
Browse files

mirror now lowers into the ground when shoulders are attached and raises when game is finished

parent e581b2f4
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -371,13 +371,17 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc ...@@ -371,13 +371,17 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
} }
//proceed when both shoulders are attached and
if (TicksWithBothTriggersPressed >=30) if (TicksWithBothTriggersPressed >=30)
{ {
UE_LOG(LogTemp, Warning, TEXT("Both Spheres attached, continuing...")); UE_LOG(LogTemp, Warning, TEXT("Both Spheres attached, continuing..."));
LevelArray[0].isFinished = true; LevelArray[0].isFinished = true;
LevelArray[0].inputRequired = false; LevelArray[0].inputRequired = false;
CurrentLevelIndex = 1; CurrentLevelIndex = 1;
//Setting Mirror Parameters
MirrorMoveDistance = 230;
} }
} }
else else
...@@ -388,6 +392,16 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc ...@@ -388,6 +392,16 @@ void UAvatarCalibration::TickComponent(float DeltaTime, ELevelTick TickType, FAc
} }
if(CurrentLevelIndex == 1) if(CurrentLevelIndex == 1)
{ {
//lower the mirror into the ground when the shoulder stage is finished
if(MirrorMoveDistance > 0)
{
FVector OldLocation = Mirror->GetActorLocation();
OldLocation.Z = OldLocation.Z - 1;
MirrorMoveDistance--;
Mirror->SetActorLocation(OldLocation);
}
LevelArray[1].LevelTicks++; LevelArray[1].LevelTicks++;
if (!LevelArray[1].isStarted) if (!LevelArray[1].isStarted)
{ {
...@@ -521,7 +535,7 @@ void UAvatarCalibration::UpdateCalibration() { ...@@ -521,7 +535,7 @@ void UAvatarCalibration::UpdateCalibration() {
{ {
//UE_LOG(LogTemp, Warning, TEXT("UpdateCalibration()")); //UE_LOG(LogTemp, Warning, TEXT("UpdateCalibration()"));
UWorld* World = GetWorld(); UWorld* World = GetWorld();
DrawDebugSphere(World, pose.HipControllerPos, 5, 30, FColor::Blue, false, 1); //DrawDebugSphere(World, pose.HipControllerPos, 5, 30, FColor::Blue, false, 1);
} }
if (calibrationMode == CalibrationMode::GAME) if (calibrationMode == CalibrationMode::GAME)
...@@ -551,8 +565,8 @@ void UAvatarCalibration::UpdateCalibration() { ...@@ -551,8 +565,8 @@ void UAvatarCalibration::UpdateCalibration() {
if (MsgDelay % 10 == 0) if (MsgDelay % 10 == 0)
{ {
UWorld* World = GetWorld(); UWorld* World = GetWorld();
DrawDebugSphere(World, pose.LeftFootPos, 5, 5, FColor::Green, false, 1); //DrawDebugSphere(World, pose.LeftFootPos, 5, 5, FColor::Green, false, 1);
DrawDebugSphere(World, pose.RightFootPos, 5, 5, FColor::Red, false, 1); //DrawDebugSphere(World, pose.RightFootPos, 5, 5, FColor::Red, false, 1);
} }
} }
...@@ -593,10 +607,10 @@ void UAvatarCalibration::UpdateCalibration() { ...@@ -593,10 +607,10 @@ void UAvatarCalibration::UpdateCalibration() {
UWorld* World = GetWorld(); UWorld* World = GetWorld();
if (World && LevelArray[1].LevelTicks <= 400) if (World && LevelArray[1].LevelTicks <= 400)
{ {
DrawDebugSphere(World, pose.LeftHandPos, 5, 5, FColor::Red, false, 1); //DrawDebugSphere(World, pose.LeftHandPos, 5, 5, FColor::Red, false, 1);
DrawDebugSphere(World, pose.RightHandPos, 5, 5, FColor::Green, false, 1); //DrawDebugSphere(World, pose.RightHandPos, 5, 5, FColor::Green, false, 1);
DrawDebugSphere(World, pose.LeftShoulderPos, 5, 5, FColor::Red, false, 1); //DrawDebugSphere(World, pose.LeftShoulderPos, 5, 5, FColor::Red, false, 1);
DrawDebugSphere(World, pose.RightShoulderPos, 5, 5, FColor::Green, false, 1); //DrawDebugSphere(World, pose.RightShoulderPos, 5, 5, FColor::Green, false, 1);
} }
} }
...@@ -615,7 +629,7 @@ void UAvatarCalibration::UpdateCalibration() { ...@@ -615,7 +629,7 @@ void UAvatarCalibration::UpdateCalibration() {
if (MsgDelay >= 60) if (MsgDelay >= 60)
{ {
UWorld* World = GetWorld(); UWorld* World = GetWorld();
DrawDebugSphere(World, pose.LeftHandPos, 10, 30, FColor::Yellow, false, 1); //DrawDebugSphere(World, pose.LeftHandPos, 10, 30, FColor::Yellow, false, 1);
} }
if (!LevelArray[3].isStarted) if (!LevelArray[3].isStarted)
...@@ -1078,6 +1092,11 @@ void UAvatarCalibration::OnLevelLoaded() { ...@@ -1078,6 +1092,11 @@ void UAvatarCalibration::OnLevelLoaded() {
RightShoulderSphere = actor; RightShoulderSphere = actor;
} }
if (actor->GetName().Contains("Mirror", ESearchCase::CaseSensitive)) {
Mirror = Cast<AStaticMeshActor>(actor);
MirrorStartZ = Mirror->GetActorLocation().Z;
}
if (actor->GetName().Contains("ProgressChart", ESearchCase::CaseSensitive)) { if (actor->GetName().Contains("ProgressChart", ESearchCase::CaseSensitive)) {
TextWall = Cast<ATextRenderActor>(actor); TextWall = Cast<ATextRenderActor>(actor);
if (TextWall) if (TextWall)
...@@ -1085,10 +1104,7 @@ void UAvatarCalibration::OnLevelLoaded() { ...@@ -1085,10 +1104,7 @@ void UAvatarCalibration::OnLevelLoaded() {
TextWall->GetTextRender()->SetText(""); TextWall->GetTextRender()->SetText("");
} }
} }
} }
} }
// check if all position actors are initialized correctly for the gamified calibration mode // check if all position actors are initialized correctly for the gamified calibration mode
if (calibrationMode == CalibrationMode::GAME) if (calibrationMode == CalibrationMode::GAME)
...@@ -1191,6 +1207,16 @@ void UAvatarCalibration::UpdateInspection() { ...@@ -1191,6 +1207,16 @@ void UAvatarCalibration::UpdateInspection() {
if(calibrationMode == CalibrationMode::GAME) if(calibrationMode == CalibrationMode::GAME)
{ {
//raise the mirror back into its original position when the calibration stage is finished
if (MirrorMoveDistance < 230)
{
FVector OldLocation = Mirror->GetActorLocation();
OldLocation.Z = OldLocation.Z + 1;
Mirror->SetActorLocation(OldLocation);
MirrorMoveDistance++;
}
if(leftTriggerPressed && rightTriggerPressed) if(leftTriggerPressed && rightTriggerPressed)
{ {
//StartCalibration(SkeletalMesh, CapsuleComponent, VROrigin); //StartCalibration(SkeletalMesh, CapsuleComponent, VROrigin);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "Components/SceneComponent.h" #include "Components/SceneComponent.h"
#include "Components/CapsuleComponent.h" #include "Components/CapsuleComponent.h"
#include "DrawDebugHelpers.h" #include "DrawDebugHelpers.h"
#include "Engine/StaticMeshActor.h"
#include "Engine/TextRenderActor.h" #include "Engine/TextRenderActor.h"
#include "AvatarCalibration.generated.h" #include "AvatarCalibration.generated.h"
...@@ -174,6 +175,7 @@ private: ...@@ -174,6 +175,7 @@ private:
UPROPERTY() AActor* GoalWallPosition = nullptr; UPROPERTY() AActor* GoalWallPosition = nullptr;
UPROPERTY() AActor* FinishPosition = nullptr; UPROPERTY() AActor* FinishPosition = nullptr;
UPROPERTY() ATextRenderActor* TextWall = nullptr; UPROPERTY() ATextRenderActor* TextWall = nullptr;
UPROPERTY() AStaticMeshActor* Mirror = nullptr;
UPROPERTY() AActor* LeftShoulderSphere = nullptr; UPROPERTY() AActor* LeftShoulderSphere = nullptr;
UPROPERTY() AActor* RightShoulderSphere = nullptr; UPROPERTY() AActor* RightShoulderSphere = nullptr;
...@@ -189,6 +191,12 @@ private: ...@@ -189,6 +191,12 @@ private:
UPROPERTY() int MinTriggerPressTicks = 100; UPROPERTY() int MinTriggerPressTicks = 100;
UPROPERTY() int CurrentTriggerPressTicks = 0; UPROPERTY() int CurrentTriggerPressTicks = 0;
UPROPERTY() int MirrorStartZ = 0;
UPROPERTY() int MirrorMoveDistance = 230;
void OnRightThumbstickClick(); void OnRightThumbstickClick();
void OnLeftThumbstickClick(); void OnLeftThumbstickClick();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment