Skip to content
Snippets Groups Projects
Commit 08ffc1aa authored by Kris Tabea Helwig's avatar Kris Tabea Helwig
Browse files

refactoring of CameraRideSecondsToUpdates; Documentation updates

parent 6f0f32a4
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ void APointOfInterestManager::ResetToPlayerStart() ...@@ -40,7 +40,7 @@ void APointOfInterestManager::ResetToPlayerStart()
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APlayerStart::StaticClass(), AllPlayerStarts); UGameplayStatics::GetAllActorsOfClass(GetWorld(), APlayerStart::StaticClass(), AllPlayerStarts);
if (AllPlayerStarts.IsEmpty()) if (AllPlayerStarts.IsEmpty())
{ {
UE_LOGFMT(POIManagerLog, Warning, "Attempted to move player pawn to PlayerStart but no PlayerStart found to move."); UE_LOGFMT(POIManagerLog, Warning, "Attempted to move player pawn to PlayerStart but no PlayerStart found to move to.");
return; return;
} }
AActor* PlayerStart = AllPlayerStarts[0]; AActor* PlayerStart = AllPlayerStarts[0];
...@@ -121,7 +121,7 @@ void APointOfInterestManager::StartCameraRide() ...@@ -121,7 +121,7 @@ void APointOfInterestManager::StartCameraRide()
CameraRideStart = UGameplayStatics::GetTimeSeconds(this); CameraRideStart = UGameplayStatics::GetTimeSeconds(this);
CameraRideEnd = CameraRideStart + SplineComponent->Duration; CameraRideEnd = CameraRideStart + SplineComponent->Duration;
CurrentUpdate = 0; CurrentUpdate = 0;
DurationInUpdates = static_cast<int>(SplineComponent->Duration * CameraRideSecondsToUpdates); DurationInUpdates = static_cast<int>(SplineComponent->Duration * CameraRideTicksToDistancePerSecond);
IsRidingCamera = true; IsRidingCamera = true;
} }
...@@ -196,7 +196,7 @@ void APointOfInterestManager::ProgressCameraRide() ...@@ -196,7 +196,7 @@ void APointOfInterestManager::ProgressCameraRide()
{ {
if (CurrentUpdate < DurationInUpdates) if (CurrentUpdate < DurationInUpdates)
{ {
float CurrentTime = 1.0f * CurrentUpdate / CameraRideSecondsToUpdates; float CurrentTime = 1.0f * CurrentUpdate / CameraRideTicksToDistancePerSecond;
FVector Location = SplineComponent->GetLocationAtTime(CurrentTime, ESplineCoordinateSpace::World); FVector Location = SplineComponent->GetLocationAtTime(CurrentTime, ESplineCoordinateSpace::World);
FRotator Rotation = SplineComponent->GetRotationAtTime(CurrentTime, ESplineCoordinateSpace::World); FRotator Rotation = SplineComponent->GetRotationAtTime(CurrentTime, ESplineCoordinateSpace::World);
Rotation.Pitch = 0; Rotation.Pitch = 0;
......
...@@ -54,11 +54,14 @@ public: ...@@ -54,11 +54,14 @@ public:
/** /**
* Only relevant when MakeCameraRideProgressionConstantBetweenTicks = true. * Only relevant when MakeCameraRideProgressionConstantBetweenTicks = true.
* The conversion rate of how many ticks the camera should update to equal the distance traveled during 1 second. * This value is the amount of ticks required to cover the distance which the camera would travel per second with the default
* USplineComponent values.
* Higher number = slower camera speed
* Lower number = higher camera speed
*/ */
UPROPERTY(EditAnywhere, Category="Point Of Interest Manager", UPROPERTY(EditAnywhere, Category="Point Of Interest Manager",
meta = (EditCondition = "MakeCameraRideProgressionConstantBetweenTicks")) meta = (EditCondition = "MakeCameraRideProgressionConstantBetweenTicks"))
int CameraRideSecondsToUpdates = 60; int CameraRideTicksToDistancePerSecond = 60;
protected: protected:
UPROPERTY(EditAnywhere) UPROPERTY(EditAnywhere)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment