19 #include "Camera/CameraComponent.h"
21 #include "CoreMinimal.h"
35 #include "RRCamera.generated.h"
61 FVector2f DistanceRangeInCm = FVector2f(100.f, 300.f);
70 FVector2f HeightRangeInCm = FVector2f(5.f, 100.f);
79 FVector2f HFoVRangeInDegree = FVector2f(80.f, 120.f);
87 UE_LOG_WITH_INFO(LogRapyutaCore, Display, TEXT(
"CameraProperties:"));
89 UE_LOG_WITH_INFO(LogRapyutaCore, Display, TEXT(
"- DistanceRangeInCm: %s"), *DistanceRangeInCm.ToString());
91 verify(FMath::IsWithinInclusive(
double(DistanceRangeInCm.X),
double(0),
double(DistanceRangeInCm.Y)));
93 UE_LOG_WITH_INFO(LogRapyutaCore, Display, TEXT(
"- HeightRangeInCm: %s"), *HeightRangeInCm.ToString());
95 verify(FMath::IsWithinInclusive(
double(HeightRangeInCm.X),
double(0),
double(HeightRangeInCm.Y)));
97 UE_LOG_WITH_INFO(LogRapyutaCore, Display, TEXT(
"- HFoVRangeInDegree: %s"), *HFoVRangeInDegree.ToString());
99 verify(FMath::IsWithinInclusive(
double(HFoVRangeInDegree.X),
double(0),
double(HFoVRangeInDegree.Y)));
135 UCameraComponent* CameraComponent =
nullptr;
150 void LookAt(
const FVector& InTargetLocation,
152 const FVector& InTargetNormal,
154 const FVector2f& InDistanceRange,
156 const FVector2f& InHeightRange,
158 const FVector2f& InAngleRange,
160 bool bMoveToNearTarget)
164 if (bMoveToNearTarget)
170 FVector randomDelta =
178 randomDelta = FQuat::FindBetweenNormals(FVector::XAxisVector, InTargetNormal.GetSafeNormal()).RotateVector(randomDelta);
186 SetActorLocation(InTargetLocation + randomDelta);
190 SetActorRotation((InTargetLocation - GetActorLocation()).ToOrientationQuat());
194 void LookAt(
const FVector& InTargetLocation,
bool bMoveToNearTarget);
198 void LookAt(
const TArray<T*>& InTargetActors,
bool bMoveToNearTarget)
208 void LookAt(
const TArray<TArray<T*>>& InTargetActorGroups,
bool bMoveToNearTarget)
218 void RandomizePose(
const FVector& InBaseLocation,
bool bIsRandomLocationOnly);
222 float GetDistanceToFloor()
const;
254 float halfFOV = FMath::DegreesToRadians(0.5f * CameraComponent->FieldOfView);
256 return (0.5f * CameraComponent->OrthoWidth) / FMath::Tan(halfFOV);