Implemented Main Waypoint Visibility Toggle
This commit is contained in:
parent
4c2ba9b3e5
commit
0e937e3e5e
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a6f84a0cd87a71d9e7634262974d939d9bf178a746ede7eaa63dbccd172691bd
|
||||
size 102150
|
||||
oid sha256:3ed86d1de4a3245d813c1133967be3069a04e0578f3ea55c142df21180ed2d7b
|
||||
size 111529
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7538c6b68b4473d388aaad70e1e43e13d21cd55e0aad078df0ca437ad6f81782
|
||||
oid sha256:842aa6cfaae2bd2428eb51ca353b53825d15505936abd000d4d38a8ac0284305
|
||||
size 654898
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c247df32a59590cde6089e45f176abfa9fec3dd67b5c4e370067412895eb2bc6
|
||||
oid sha256:d321261b35d69be06fe122656bd29de989a8d3927aec5a410ddc9c80d1c97540
|
||||
size 66790690
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user