Skip to content
Snippets Groups Projects
Commit 7fab33e6 authored by Klara Tyroller's avatar Klara Tyroller
Browse files

mimick delay in eye movement implemented

parent 4eb49c53
Branches
No related tags found
No related merge requests found
...@@ -417,8 +417,58 @@ FRotator UVHListenerBackchannels::MyFindLookAtRotaion(FVector Start, FVector Tar ...@@ -417,8 +417,58 @@ FRotator UVHListenerBackchannels::MyFindLookAtRotaion(FVector Start, FVector Tar
void UVHListenerBackchannels::GazeController(FRotator HeadRotation) void UVHListenerBackchannels::GazeController(FRotator HeadRotation)
{ {
float TimePassed = GetWorld()->GetRealTimeSeconds();
FVector point = GetPlayerLookAtTarget(10000); FVector point = GetPlayerLookAtTarget(10000);
if (chameleon)
{
if (in_VH_FieldofView(point, HeadRotation))
{
EyeMimickQueue.push(point);
}
else
{
EyeMimickQueue.push(FVector(0.0, 0.0, 0.0));
}
if (TimePassed > mimick_delay)
{
if (EyeMimickQueue.front() == FVector(0.0, 0.0, 0.0))
{
EyeMimickQueue.pop();
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, true);
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, false);
}
else
{
point = EyeMimickQueue.front();
EyeMimickQueue.pop();
SetEyeLookAtTarget(point, HeadRotation, true);
SetEyeLookAtTarget(point, HeadRotation, false);
}
}
else
{
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, true);
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, false);
}
}
else
{
if (in_VH_FieldofView(point, HeadRotation))
{
SetEyeLookAtTarget(GetPlayerLookAtTarget(10000), HeadRotation, true);
SetEyeLookAtTarget(GetPlayerLookAtTarget(10000), HeadRotation, false);
}
else
{
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, true);
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, false);
}
}
/*
if (in_VH_FieldofView(point,HeadRotation )) if (in_VH_FieldofView(point,HeadRotation ))
{ {
SetEyeLookAtTarget(GetPlayerLookAtTarget(10000), HeadRotation, true); SetEyeLookAtTarget(GetPlayerLookAtTarget(10000), HeadRotation, true);
...@@ -429,6 +479,7 @@ void UVHListenerBackchannels::GazeController(FRotator HeadRotation) ...@@ -429,6 +479,7 @@ void UVHListenerBackchannels::GazeController(FRotator HeadRotation)
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, true); SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, true);
SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, false); SetEyeLookAtTarget(Player_vr_pawn->Head->GetComponentLocation(), HeadRotation, false);
} }
*/
} }
...@@ -436,6 +487,7 @@ bool UVHListenerBackchannels::in_VH_FieldofView(FVector Point, FRotator HeadRota ...@@ -436,6 +487,7 @@ bool UVHListenerBackchannels::in_VH_FieldofView(FVector Point, FRotator HeadRota
{ {
FRotator LookAtTargetRot = LookAtTarget(Point); FRotator LookAtTargetRot = LookAtTarget(Point);
FRotator difference = LookAtTargetRot - HeadRotation; FRotator difference = LookAtTargetRot - HeadRotation;
//if ((abs(difference.Yaw) > 107.0) || (abs(difference.Roll) > 70.0))
if ((abs(difference.Yaw) > 107.0) || (abs(difference.Roll) > 70.0)) if ((abs(difference.Yaw) > 107.0) || (abs(difference.Roll) > 70.0))
{ {
return false; return false;
......
...@@ -60,8 +60,11 @@ private: ...@@ -60,8 +60,11 @@ private:
float BlinkValue = 0.0; float BlinkValue = 0.0;
float mimick_delay = 4.0; //in s float mimick_delay = 4.0; //in s
std::queue<FRotator>MimickQueue; std::queue<FRotator>MimickQueue;
std::queue<FVector>EyeMimickQueue;
std::array<FRotator, 50> a1 = { FRotator(0.0, 0.0, 0.0)}; std::array<FRotator, 50> a1 = { FRotator(0.0, 0.0, 0.0)};
int counter = 0; int counter = 0;
std::array<FVector, 50> a2 = { FVector(0.0, 0.0, 0.0) };
//int counter2 = 0;
FRotator NodRotator = FRotator(0.0f, 0.0f, 0.0f); FRotator NodRotator = FRotator(0.0f, 0.0f, 0.0f);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment