Custom Time Dilation and Camera Movement

SteveDM
Tue, 28 May 2019 18:52:18 +0000
Cinematics & Media

I’ve been struggling with this for a while and am hoping that it’s just looking too closely at the problem to see the solution.

I’ve set up a custom camera using an Unreal tutorial. The camera moves with the following code:

		MovementInput = MovementInput.GetSafeNormal() * 1000.f;
		FVector NewLocation = GetActorLocation();
		NewLocation += GetActorForwardVector() * MovementInput.X * DeltaTimeWithDilation;
		NewLocation += GetActorRightVector() * MovementInput.Y * DeltaTimeWithDilation;
		SetActorLocation(NewLocation);

It’s for an RTS so I’ve been trying to set variable speeds using the SetGlobalTimeDilation function.

This obviously affects the speed that the camera moves at so I set up another variable to divide by DeltaTime which will always give me the same movement speed, regardless of the dilation. This works fully with the pan, zoom and rotate function.

It also works with the game when it is set to any speed except 0 when the game is “paused”. This is when the time dilation is set to the lowest value (0.0001f), the tick function of the camera still works (as shown when the game is “un-paused” because the camera instantly moves to it’s new location but it will not update the camera until then.

Please tell me how I do this!

2 posts - 1 participant