Crosshairs are now only visible when nothing is hit by the line trace, to further improve visibility.

This commit is contained in:
Jamie Greunbaum 2023-03-27 14:07:20 -04:00
parent da81ee271e
commit 1d15350610
3 changed files with 6 additions and 2 deletions

View File

@ -94,17 +94,18 @@ void ABugPlacerPawn::TraceTimerElapsed()
if (ABugMarkerActor *Marker = Cast<ABugMarkerActor>(TraceHit.GetActor()))
{
this->PlacementMarkerRoot->SetVisibility(true, false);
this->ShowDummyMarker(false);
this->UpdateBugInformation(Marker->GetBugData());
this->ShowDummyMarker(false);
}
else
{
this->PlacementMarkerRoot->SetVisibility(true, true);
this->ShowDummyMarker(true);
this->UpdateBugInformation(FJSONBugData());
this->ShowDummyMarker(true);
}
this->PlacementMarkerRoot->SetWorldLocationAndRotation(TraceHit.ImpactPoint, FRotationMatrix::MakeFromZ(TraceHit.ImpactNormal).ToQuat());
this->ShowCrosshairs(false);
const FVector TraceOriginLocation = this->TraceOriginComponent->GetComponentLocation();
FVector FacingVector = (TraceHit.ImpactPoint - TraceOriginLocation);
@ -118,6 +119,7 @@ void ABugPlacerPawn::TraceTimerElapsed()
{
this->PlacementMarkerRoot->SetRelativeLocationAndRotation(FVector::ZeroVector, FRotator::ZeroRotator);
this->PlacementMarkerRoot->SetVisibility(false, true);
this->ShowCrosshairs(true);
const FVector TraceOriginLocation = this->TraceOriginComponent->GetComponentLocation();
FVector FacingVector = (TraceEnd - TraceOriginLocation);

View File

@ -30,6 +30,8 @@ public:
void UpdateBugInformation(const FJSONBugData &BugData);
UFUNCTION(BlueprintImplementableEvent)
void ShowDummyMarker(const bool bShow);
UFUNCTION(BlueprintImplementableEvent)
void ShowCrosshairs(const bool bShow);
UFUNCTION(BlueprintCallable, meta=(WorldContext="WorldContextObject"))
static void SpawnBugPlacerPawn(const UObject *WorldContextObject, TSubclassOf<ABugPlacerPawn> Class);