0 votes

Hi,

I've seen this question: https://godotengine.org/qa/4616/any-way-to-manipulate-time-scale

I'm trying to add time controls to my game and have working pause, play, and fast forward buttons, but setting Engine.time_scale also affects my animation speed - I have some animations on screen and on my HUD that I don't want to be affected.

Is there any way to use Engine.time_scale without affecting my animations, or is there a better method of time control I could use?

in Engine by (49 points)

1 Answer

+1 vote
Best answer

I see two ways you can go about this:

1) The easier method involves setting the speed of the animations according to the engine's time scale, e.g. double animation speed if time slows down to 1/2 of normal speed. This is a property you can set via the AnimationPlayer node and I'm sure the same must hold true for HUD elements too.

2) The more difficult option would be to not use Engine.time_scale at all. Instead, create variables that act as speed factors for all your movements in game. Then multiply movements speed by said factors to achieve the desired result. For example, if a kinematic body moves with a speed of Vector3(2, 0, 0), increase the speed by multiplying it by a factor of 2 when time speeds up or decrease it by multiplying by a factor of 0.5 when time slows down.

by (1,838 points)
selected by

Seems like the best solution for me would be the second option. I really like the ease of using Engine.time_scale, but I still need my animations to play when the game is paused.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.