Skip to content
Snippets Groups Projects
Commit 5bfb0ceb authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

Debug output cave tracking

parent 83e7b344
No related branches found
No related tags found
2 merge requests!9VAServerLauncher Improvement (now also sending reproduction type and ini),!8Debug output cave tracking
......@@ -8,6 +8,7 @@
#include "SoundSource/VASoundSourceRepresentation.h"
#include "Engine/World.h"
#include "Utility/VirtualRealityUtilities.h"
// ****************************************************************** //
......@@ -73,7 +74,7 @@ void FVASoundSource::SetPosition(const FVector NewPosition)
{
Position = NewPosition;
if (!FVAPlugin::SetSoundSourcePosition(SoundSourceID, Position))
if (!FVAPlugin::SetSoundSourcePosition(SoundSourceID, Position) && UVirtualRealityUtilities::IsMaster())
{
FVAUtils::LogStuff("[FVASoundSource::SetPosition()]:" +
FString(" Could not set sound source position in VA. Position of visual and auditive representation might mismatch now."), true);
......@@ -86,7 +87,7 @@ void FVASoundSource::SetRotation(const FRotator NewRotation)
{
Rotation = NewRotation;
if (!FVAPlugin::SetSoundSourceRotation(SoundSourceID, Rotation))
if (!FVAPlugin::SetSoundSourceRotation(SoundSourceID, Rotation) && UVirtualRealityUtilities::IsMaster())
{
FVAUtils::LogStuff("[FVASoundSource::SetRotation()]:" +
FString(" Could not set sound source rotation in VA. Orientation of visual and auditive representation might mismatch now."), true);
......
......@@ -257,13 +257,28 @@ bool AVAReceiverActor::UpdateVirtualWorldPose()
if(TrackingSource == ETrackingSource::VirtualRealityPawn)
{
// Auralization Pose is coppled to the Virtual Reality Pawn, e.g, HMD, CAVE
FVector ViewPos;
FRotator ViewRot;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(ViewPos, ViewRot);
// Auralization Pose is coupled to the Virtual Reality Pawn, e.g, HMD, CAVE
AVirtualRealityPawn* VirtualRealityPawn = Cast<AVirtualRealityPawn>(GetWorld()->GetFirstPlayerController()->AcknowledgedPawn);
if (VirtualRealityPawn == nullptr)
{
return false;
}
USceneComponent* Head = VirtualRealityPawn->Head;
if (!Head)
{
return false;
}
FVector ViewPos = Head->GetComponentLocation();
FRotator ViewRot = Head->GetComponentRotation();
//Offset from ViewPoint (between eyes) to head center, rotate according to view rotation
ViewPos += ViewRot.RotateVector(ViewpointToHeadcenterOffset);
bool bResult = true;
bResult &= FVAPlugin::SetSoundReceiverPosition(ReceiverID, ViewPos + ViewRot.RotateVector(ViewpointToHeadcenterOffset)); //Offset from ViewPoint (between eyes) to head center, rotate according to view rotation
bResult &= FVAPlugin::SetSoundReceiverPosition(ReceiverID, ViewPos);
bResult &= FVAPlugin::SetSoundReceiverRotation(ReceiverID, ViewRot);
return bResult;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment