Introduce separate boolean for LookingAtPlayer and FollowPlayer
This commit is contained in:
parent
66a782609d
commit
6d2d0d8146
|
@ -30,7 +30,7 @@ void ACameraVolume::Tick(float DeltaSeconds)
|
|||
{
|
||||
Super::Tick(DeltaSeconds);
|
||||
|
||||
if (IsActive && FollowPlayer && TankPlayerCharacter)
|
||||
if (IsActive && LookAtPlayer && TankPlayerCharacter)
|
||||
{
|
||||
TankPlayerCharacter->CameraComponent->SetWorldRotation(UKismetMathLibrary::FindLookAtRotation(
|
||||
ArrowComponent->GetComponentTransform().GetLocation(), TankPlayerCharacter->GetTransform().GetLocation()));
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
UCameraComponent* DebugCamera;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool FollowPlayer = false;
|
||||
bool LookAtPlayer = false;
|
||||
|
||||
protected:
|
||||
UPROPERTY()
|
||||
|
|
|
@ -9,7 +9,6 @@ ASplineCameraVolume::ASplineCameraVolume()
|
|||
{
|
||||
SplineComponent = CreateDefaultSubobject<USplineComponent>(TEXT("Spline Component"));
|
||||
SplineComponent->SetupAttachment(RootComponent);
|
||||
FollowPlayer = true;
|
||||
}
|
||||
|
||||
void ASplineCameraVolume::BeginPlay()
|
||||
|
@ -25,7 +24,11 @@ void ASplineCameraVolume::Tick(float DeltaSeconds)
|
|||
TankPlayerCharacter->GetTransform().GetLocation(), ESplineCoordinateSpace::World);
|
||||
|
||||
TankPlayerCharacter->CameraComponent->SetWorldLocation(Location);
|
||||
}
|
||||
|
||||
if (IsActive && LookAtPlayer && TankPlayerCharacter)
|
||||
{
|
||||
TankPlayerCharacter->CameraComponent->SetWorldRotation(UKismetMathLibrary::FindLookAtRotation(
|
||||
Location, TankPlayerCharacter->GetTransform().GetLocation()));
|
||||
TankPlayerCharacter->GetTransform().GetLocation(), TankPlayerCharacter->GetTransform().GetLocation()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ public:
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
USplineComponent* SplineComponent;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool FollowPlayer = true;
|
||||
|
||||
ASplineCameraVolume();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
|
Loading…
Reference in New Issue