Custom Time Dilation and Camera Movement

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!

Hello SteveDM,

If I am understanding your question correctly I believe I have a good starting point for you. You could make a manager (an actor that other actors listen to so they all receive instructions at the same time) with functions that would dictate the CustomTimeDilations for all the relevant actors. All the relevant actors would have to subscribe to the manager, but it could simplify this aspect of your game.

Some benefits:

  1. Set the CustomTimeDilation of a specific group of actors (Ex. Set it to 0, effectively freezing them and keep the camera moving at the normal speed).
  2. Alter the camera speed or CustomTimeDilation without taking into account the GlobalTimeDilation.

Thanks,