Implemented Main Waypoint Visibility Toggle

This commit is contained in:
Rafal Swierczek 2023-11-26 16:14:01 +00:00
parent 4c2ba9b3e5
commit 0e937e3e5e
5 changed files with 27 additions and 15 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:a6f84a0cd87a71d9e7634262974d939d9bf178a746ede7eaa63dbccd172691bd oid sha256:3ed86d1de4a3245d813c1133967be3069a04e0578f3ea55c142df21180ed2d7b
size 102150 size 111529

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:7538c6b68b4473d388aaad70e1e43e13d21cd55e0aad078df0ca437ad6f81782 oid sha256:842aa6cfaae2bd2428eb51ca353b53825d15505936abd000d4d38a8ac0284305
size 654898 size 654898

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:c247df32a59590cde6089e45f176abfa9fec3dd67b5c4e370067412895eb2bc6 oid sha256:d321261b35d69be06fe122656bd29de989a8d3927aec5a410ddc9c80d1c97540
size 66790690 size 66790690

View File

@ -3,6 +3,7 @@
#include "WaypointActor.h" #include "WaypointActor.h"
#include "Engine/EngineTypes.h"
#include "EndlessVendetta/EndlessVendettaCharacter.h" #include "EndlessVendetta/EndlessVendettaCharacter.h"
// Sets default values // Sets default values
@ -31,26 +32,31 @@ void AWaypointActor::Tick(float DeltaTime)
{ {
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
if (SightCheck())
{
UpdateVisibility(true);
UpdateScaleAndRotation(); UpdateScaleAndRotation();
return;
}
UpdateVisibility(false);
} }
bool AWaypointActor::SightCheck() bool AWaypointActor::SightCheck()
{ {
FHitResult OutHit; FHitResult OutHit;
// FCollisionQueryParams CollisionParams = FCollisionQueryParams::DefaultQueryParam; FCollisionObjectQueryParams ObjectQueryParams;
// CollisionParams.AddIgnoredActor(PlayersCam->GetOwner()); ObjectQueryParams.AddObjectTypesToQuery(ECollisionChannel::ECC_GameTraceChannel2);
FCollisionObjectQueryParams CollisionParams; FVector LT_Start = PlayersCam->GetComponentLocation();
ECollisionChannel CollisionChannel; FVector LT_End = LT_Start + (PlayersCam->GetForwardVector() * WaypointFocusDistance);
CollisionParams.AddObjectTypesToQuery(this->GetComponentsCollisionResponseToChannel()) if (GetWorld()->LineTraceSingleByObjectType(OutHit, LT_Start, LT_End, ObjectQueryParams)) return true;
FVector LT_Start = PlayersCam->GetSocketLocation(); return false;
FVector LT_End = LT_Start + (PlayersCam->GetForwardVector() * 3000);
GetWorld()->LineTraceSingleByObjectType()
} }
void AWaypointActor::UpdateScaleAndRotation() void AWaypointActor::UpdateScaleAndRotation()
{ {
UE_LOG(LogTemp, Warning, TEXT("Looked at? = %s"), (SightCheck ? TEXT("True") : TEXT("False")));
if (!PlayersCam) return; if (!PlayersCam) return;
FVector WaypointLoc = GetActorLocation(); FVector WaypointLoc = GetActorLocation();

View File

@ -18,6 +18,9 @@ class ENDLESSVENDETTA_API AWaypointActor : public AActor
float ScalingY_Intercept; float ScalingY_Intercept;
UPROPERTY(EditDefaultsOnly, Category = "Waypoint")
float WaypointFocusDistance = 3000;
UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling") UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling")
float MaxDist = 16000.f; float MaxDist = 16000.f;
@ -38,6 +41,9 @@ protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned
virtual void BeginPlay() override; virtual void BeginPlay() override;
UFUNCTION(BlueprintImplementableEvent)
void UpdateVisibility(bool IsVisible);
public: public:
// Sets default values for this actor's properties // Sets default values for this actor's properties
AWaypointActor(); AWaypointActor();