Skip to content
Snippets Groups Projects
Commit 86bfd750 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

More debugging

parent 8de71fd3
No related branches found
No related tags found
1 merge request!4Develop
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"Version": 1, "Version": 1,
"VersionName": "1.0", "VersionName": "1.0",
"FriendlyName": "CAVEOverlay", "FriendlyName": "CAVEOverlay",
"Description": "Adds the ability to black out the CAVE Doors and display the magic tape", "Description": "Adds the ability to black out the CAVE door and display the magic tape",
"Category": "Other", "Category": "Other",
"CreatedBy": "", "CreatedBy": "",
"CreatedByURL": "", "CreatedByURL": "",
......
...@@ -43,30 +43,30 @@ ACAVEOverlayController::ACAVEOverlayController() ...@@ -43,30 +43,30 @@ ACAVEOverlayController::ACAVEOverlayController()
} }
//Creation of subcomponents //Creation of subcomponents
root = CreateDefaultSubobject<USceneComponent>(TEXT("DefaultSceneRoot")); root = CreateDefaultSubobject<USceneComponent>("DefaultSceneRoot");
SetRootComponent(root); SetRootComponent(root);
tape_root = CreateDefaultSubobject<USceneComponent>(TEXT("TapeRoot")); tape_root = CreateDefaultSubobject<USceneComponent>("TapeRoot");
sign_root = CreateDefaultSubobject<USceneComponent>(TEXT("SignRoot")); sign_root = CreateDefaultSubobject<USceneComponent>("SignRoot");
tape_root->SetupAttachment(root); tape_root->SetupAttachment(root);
sign_root->SetupAttachment(root); sign_root->SetupAttachment(root);
//Loading of Materials and Meshes //Loading of Materials and Meshes
loadAsset(TEXT("/CAVEOverlay/Stripes"), tape_material_); loadAsset("/CAVEOverlay/Stripes", tape_material_);
loadAsset(TEXT("/CAVEOverlay/StopMaterial"), sign_material_); loadAsset("/CAVEOverlay/StopMaterial", sign_material_);
loadAsset(TEXT("/CAVEOverlay/Plane"), plane_mesh_); loadAsset("/CAVEOverlay/Plane", plane_mesh_);
tape_material_dynamic_ = UMaterialInstanceDynamic::Create(tape_material_, NULL); tape_material_dynamic_ = UMaterialInstanceDynamic::Create(tape_material_, tape_root);
sign_material_dynamic_ = UMaterialInstanceDynamic::Create(sign_material_, NULL); sign_material_dynamic_ = UMaterialInstanceDynamic::Create(sign_material_, sign_root);
tape_negative_y = createMeshComponent(FName("TapeNegY"), tape_material_dynamic_, plane_mesh_, tape_root); tape_negative_y = createMeshComponent("TapeNegY", tape_material_dynamic_, plane_mesh_, tape_root);
tape_negative_x = createMeshComponent(FName("TapeNegX"), tape_material_dynamic_, plane_mesh_, tape_root); tape_negative_x = createMeshComponent("TapeNegX", tape_material_dynamic_, plane_mesh_, tape_root);
tape_positive_y = createMeshComponent(FName("TapePosY"), tape_material_dynamic_, plane_mesh_, tape_root); tape_positive_y = createMeshComponent("TapePosY", tape_material_dynamic_, plane_mesh_, tape_root);
tape_positive_x = createMeshComponent(FName("TapePosX"), tape_material_dynamic_, plane_mesh_, tape_root); tape_positive_x = createMeshComponent("TapePosX", tape_material_dynamic_, plane_mesh_, tape_root);
sign_negative_y = createMeshComponent(FName("SignNegY"), sign_material_dynamic_, plane_mesh_, sign_root); sign_negative_y = createMeshComponent("SignNegY", sign_material_dynamic_, plane_mesh_, sign_root);
sign_negative_x = createMeshComponent(FName("SignNegX"), sign_material_dynamic_, plane_mesh_, sign_root); sign_negative_x = createMeshComponent("SignNegX", sign_material_dynamic_, plane_mesh_, sign_root);
sign_positive_y = createMeshComponent(FName("SignPosY"), sign_material_dynamic_, plane_mesh_, sign_root); sign_positive_y = createMeshComponent("SignPosY", sign_material_dynamic_, plane_mesh_, sign_root);
sign_positive_x = createMeshComponent(FName("SignPosX"), sign_material_dynamic_, plane_mesh_, sign_root); sign_positive_x = createMeshComponent("SignPosX", sign_material_dynamic_, plane_mesh_, sign_root);
//Set initial Position, Rotation and Scale of Tape //Set initial Position, Rotation and Scale of Tape
tape_negative_y->SetRelativeLocationAndRotation(FVector(0, -wall_distance_, 0), FRotator(0, 0, 90)); tape_negative_y->SetRelativeLocationAndRotation(FVector(0, -wall_distance_, 0), FRotator(0, 0, 90));
...@@ -164,6 +164,9 @@ void ACAVEOverlayController::BeginPlay() ...@@ -164,6 +164,9 @@ void ACAVEOverlayController::BeginPlay()
player_pawn_ = Cast<AVirtualRealityPawn>(GetWorld()->GetFirstPlayerController()->GetPawn()); player_pawn_ = Cast<AVirtualRealityPawn>(GetWorld()->GetFirstPlayerController()->GetPawn());
refreshPawnComponents(); refreshPawnComponents();
//Debugging
UE_LOG(CAVEOverlayLog, Error, TEXT("Tape: %p, Sign: %p"), tape_material_dynamic_, sign_material_dynamic_);
} }
float ACAVEOverlayController::calculateOpacityFromPosition(FVector position) { float ACAVEOverlayController::calculateOpacityFromPosition(FVector position) {
...@@ -220,11 +223,14 @@ void ACAVEOverlayController::Tick(float DeltaTime) ...@@ -220,11 +223,14 @@ void ACAVEOverlayController::Tick(float DeltaTime)
//Sign Logic //Sign Logic
UDisplayClusterSceneComponent* flystick = IDisplayCluster::Get().GetGameMgr()->GetNodeById(TEXT("flystick")); UDisplayClusterSceneComponent* flystick = IDisplayCluster::Get().GetGameMgr()->GetNodeById(TEXT("flystick"));
if (flystick != nullptr) { if (flystick) {
FVector flystick_position = flystick->GetRelativeTransform().GetLocation(); FVector flystick_position = flystick->GetRelativeTransform().GetLocation();
bool flystick_in_door = positionInDoorOpening(flystick_position); bool flystick_in_door = positionInDoorOpening(flystick_position);
float sign_opacity = calculateOpacityFromPosition(flystick_position); float sign_opacity = calculateOpacityFromPosition(flystick_position);
//Debugging
UE_LOG(CAVEOverlayLog, Error, TEXT("Fly: %p, Pos: (%f,%f,%f), Opacity: %f"), flystick, flystick_position.X, flystick_position.Y, flystick_position.Z, sign_opacity);
sign_negative_x->SetRelativeLocation(FVector(-wall_distance_, flystick_position.Y, flystick_position.Z)); sign_negative_x->SetRelativeLocation(FVector(-wall_distance_, flystick_position.Y, flystick_position.Z));
sign_negative_y->SetRelativeLocation(FVector(flystick_position.X, -wall_distance_, flystick_position.Z)); sign_negative_y->SetRelativeLocation(FVector(flystick_position.X, -wall_distance_, flystick_position.Z));
sign_positive_x->SetRelativeLocation(FVector(+wall_distance_, flystick_position.Y, flystick_position.Z)); sign_positive_x->SetRelativeLocation(FVector(+wall_distance_, flystick_position.Y, flystick_position.Z));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment