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

Altered calculation and added debug output for attachment

parent c7770f81
No related branches found
No related tags found
1 merge request!4Develop
...@@ -184,11 +184,15 @@ void ACAVEOverlayController::BeginPlay() ...@@ -184,11 +184,15 @@ void ACAVEOverlayController::BeginPlay()
if (!attached_ && cave_origin_) { if (!attached_ && cave_origin_) {
AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale); AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
attached_ = true; attached_ = true;
UE_LOG(CAVEOverlayLog, Log, TEXT("Attached to CaveOrigin"));
} }
} }
float ACAVEOverlayController::calculateOpacityFromPosition(FVector position) { float ACAVEOverlayController::calculateOpacityFromPosition(FVector position) {
return 1 - FMath::Clamp(((FVector2D(position).GetAbs() - FVector2D(wall_distance_ - wall_close_distance_, wall_distance_ - wall_close_distance_)) / wall_fade_distance_).GetAbsMax(), 0.0f, 1.0f); return FMath::Max(
FMath::Clamp((FMath::Abs(position.X) - (wall_distance_ - wall_close_distance_)) / wall_fade_distance_, 0.0f, 1.0f),
FMath::Clamp((FMath::Abs(position.Y) - (wall_distance_ - wall_close_distance_)) / wall_fade_distance_, 0.0f, 1.0f)
);
} }
bool ACAVEOverlayController::positionInDoorOpening(FVector position) { bool ACAVEOverlayController::positionInDoorOpening(FVector position) {
...@@ -216,6 +220,7 @@ void ACAVEOverlayController::Tick(float DeltaTime) ...@@ -216,6 +220,7 @@ void ACAVEOverlayController::Tick(float DeltaTime)
if (!attached_ && cave_origin_) { if (!attached_ && cave_origin_) {
AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale); AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
attached_ = true; attached_ = true;
UE_LOG(CAVEOverlayLog, Log, TEXT("Attached to CaveOrigin"));
} }
if (!shutter_glasses_) return; //Display Cluster not initialized if (!shutter_glasses_) return; //Display Cluster not initialized
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment