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

Changed moving to attachment. Fixed attachment and forced door position to be...

Changed moving to attachment. Fixed attachment and forced door position to be in the correct side. Rebound function to Action1 instead of DisplayClusterAction1
parent 0ecd655f
No related branches found
No related tags found
1 merge request!4Develop
......@@ -156,7 +156,7 @@ void ACAVEOverlayController::BeginPlay()
if (!display_cluster_mode_) return; // Not our business
//Actor config
InputComponent->BindAction("DisplayClusterAction1", EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
InputComponent->BindAction("Action1", EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
InputComponent->BindKey(EKeys::F10, EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
//Determine the screentype for later usage
......@@ -180,15 +180,20 @@ void ACAVEOverlayController::BeginPlay()
player_pawn_ = Cast<AVirtualRealityPawn>(GetWorld()->GetFirstPlayerController()->GetPawn());
refreshPawnComponents();
if (!attached_ && cave_origin_) {
AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
attached_ = true;
}
}
float ACAVEOverlayController::calculateOpacityFromPosition(FVector position) {
return 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 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);
}
bool ACAVEOverlayController::positionInDoorOpening(FVector position) {
return FMath::IsWithinInclusive(position.X, wall_distance_ + 10 - 20 - wall_close_distance_, wall_distance_ + 10) //Overlap both sides 10cm
&& FMath::IsWithinInclusive(position.Y, wall_distance_ + 10 - door_current_opening_width_absolute_, wall_distance_ + 10); //Overlap one side 10cm
return FMath::IsWithinInclusive(-position.X, wall_distance_ + 10 - 20 - wall_close_distance_, wall_distance_ + 10) //Overlap both sides 10cm
&& FMath::IsWithinInclusive(-position.Y, wall_distance_ + 10 - door_current_opening_width_absolute_, wall_distance_ + 10); //Overlap one side 10cm
}
void ACAVEOverlayController::refreshPawnComponents(){
......@@ -208,10 +213,12 @@ void ACAVEOverlayController::Tick(float DeltaTime)
if (!display_cluster_mode_) return; // Not our business
refreshPawnComponents();
if (!cave_origin_ || !shutter_glasses_) return; //Display Cluster not initialized
if (!attached_ && cave_origin_) {
AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
attached_ = true;
}
//Move complete actor around
SetActorLocationAndRotation(cave_origin_->GetComponentLocation(), cave_origin_->GetComponentQuat());
if (!shutter_glasses_) return; //Display Cluster not initialized
//Tape Logic
FVector shutter_position = shutter_glasses_->GetRelativeTransform().GetLocation();
......
......@@ -72,6 +72,7 @@ private:
bool positionInDoorOpening(FVector position);
//Pawn Components
bool attached_ = false;
void refreshPawnComponents();
AVirtualRealityPawn* player_pawn_;
UDisplayClusterSceneComponent* cave_origin_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment