diff --git a/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset b/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset index 24e94150..7069f767 100644 --- a/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset +++ b/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a6f84a0cd87a71d9e7634262974d939d9bf178a746ede7eaa63dbccd172691bd -size 102150 +oid sha256:3ed86d1de4a3245d813c1133967be3069a04e0578f3ea55c142df21180ed2d7b +size 111529 diff --git a/EndlessVendetta/Content/Levels/TrainingFacility.umap b/EndlessVendetta/Content/Levels/TrainingFacility.umap index 1f195d7d..5efb1b8d 100644 --- a/EndlessVendetta/Content/Levels/TrainingFacility.umap +++ b/EndlessVendetta/Content/Levels/TrainingFacility.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7538c6b68b4473d388aaad70e1e43e13d21cd55e0aad078df0ca437ad6f81782 +oid sha256:842aa6cfaae2bd2428eb51ca353b53825d15505936abd000d4d38a8ac0284305 size 654898 diff --git a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset index 073fc784..0befbad2 100644 --- a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset +++ b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c247df32a59590cde6089e45f176abfa9fec3dd67b5c4e370067412895eb2bc6 +oid sha256:d321261b35d69be06fe122656bd29de989a8d3927aec5a410ddc9c80d1c97540 size 66790690 diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.cpp index b5b82015..939bbd9e 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.cpp @@ -3,6 +3,7 @@ #include "WaypointActor.h" +#include "Engine/EngineTypes.h" #include "EndlessVendetta/EndlessVendettaCharacter.h" // Sets default values @@ -30,27 +31,32 @@ void AWaypointActor::BeginPlay() void AWaypointActor::Tick(float DeltaTime) { Super::Tick(DeltaTime); + + if (SightCheck()) + { + UpdateVisibility(true); + UpdateScaleAndRotation(); + return; + } + + UpdateVisibility(false); + - UpdateScaleAndRotation(); } bool AWaypointActor::SightCheck() { FHitResult OutHit; - // FCollisionQueryParams CollisionParams = FCollisionQueryParams::DefaultQueryParam; - // CollisionParams.AddIgnoredActor(PlayersCam->GetOwner()); - FCollisionObjectQueryParams CollisionParams; - ECollisionChannel CollisionChannel; - CollisionParams.AddObjectTypesToQuery(this->GetComponentsCollisionResponseToChannel()) - FVector LT_Start = PlayersCam->GetSocketLocation(); - FVector LT_End = LT_Start + (PlayersCam->GetForwardVector() * 3000); - GetWorld()->LineTraceSingleByObjectType() + FCollisionObjectQueryParams ObjectQueryParams; + ObjectQueryParams.AddObjectTypesToQuery(ECollisionChannel::ECC_GameTraceChannel2); + FVector LT_Start = PlayersCam->GetComponentLocation(); + FVector LT_End = LT_Start + (PlayersCam->GetForwardVector() * WaypointFocusDistance); + if (GetWorld()->LineTraceSingleByObjectType(OutHit, LT_Start, LT_End, ObjectQueryParams)) return true; + return false; } - void AWaypointActor::UpdateScaleAndRotation() { - UE_LOG(LogTemp, Warning, TEXT("Looked at? = %s"), (SightCheck ? TEXT("True") : TEXT("False"))); if (!PlayersCam) return; FVector WaypointLoc = GetActorLocation(); diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h index 6fdff1ca..e8936dec 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h @@ -18,6 +18,9 @@ class ENDLESSVENDETTA_API AWaypointActor : public AActor float ScalingY_Intercept; + UPROPERTY(EditDefaultsOnly, Category = "Waypoint") + float WaypointFocusDistance = 3000; + UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling") float MaxDist = 16000.f; @@ -38,6 +41,9 @@ protected: // Called when the game starts or when spawned virtual void BeginPlay() override; + UFUNCTION(BlueprintImplementableEvent) + void UpdateVisibility(bool IsVisible); + public: // Sets default values for this actor's properties AWaypointActor();