[SOLVED] Slow Motion

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
GVovkiv
Party member
Posts: 683
Joined: Fri Jan 15, 2021 7:29 am

Re: [SOLVED] Slow Motion

Post by GVovkiv »

Gunroar:Cannon() wrote: Thu Aug 19, 2021 10:49 pm
pgimeno wrote: Thu Aug 19, 2021 8:02 pm You want to modify time, and doing exactly that is bad practice?
Image
:rofl: :rofl: :rofl:
GVovkiv wrote: Thu Aug 19, 2021 10:21 pm So, you want to break our timeline with that dark magic, yeah?
:rofl: You can preserve the time line continuum by going back to the origional time line after the modification. Using dark magic twice. Two negatives = 1 positive :P

Code: Select all

olddt = dt

dt = dt/slow

updateEntities(dt)

dt = olddt

updateThe Rest
Oh, i get it now...
You all just crazy...
Yeah, crazy...
User avatar
Gunroar:Cannon()
Party member
Posts: 1136
Joined: Thu Dec 10, 2020 1:57 am

Re: [SOLVED] Slow Motion

Post by Gunroar:Cannon() »

GVovkiv wrote: Thu Aug 19, 2021 10:55 pm
Oh, i get it now...
You all just crazy...
Yeah, crazy...
Come to think of it, the timeline has now been messed up and in an alternate created one we're all crazy :crazy: . Then if you dare to double-mess with the timeline yet again you could go back to a time where you could prevent the messing up of dt (though in the process creating a hundred new timelines, where they do more or less the same thing, thus infinitum timelines :?) . What am I saying :P
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
TRI99ER
Prole
Posts: 13
Joined: Fri May 28, 2021 3:28 pm

Re: [SOLVED] Slow Motion

Post by TRI99ER »

The problem I had was not with dt or slowing time, but with modifying velocity directly instead of modifying the parameters in function. I figured out the solution to my problem even before anyone else posted and I even added [SOLVED] to topic name.

I don't need modifying global dt, because I don't want all my UI etc. to be slowed down. That's why it's bad practice. If you do something in one place and then need to revert it in the other place is a the definition of bad practice. I'm thankful for advice, but when anyone recommends a bad solution, I will write that it is a bad solution.

The solution with "dt2 = dt / 2" is also not ideal, because it would mean I would have a second global tick variable, which would be updated every tick for no reason. Instead I created a variable, that is not updating every tick and just represents time dilation. It's only modified whenever I want to slow down or speed up time and it's multiplied by the velocities of things, which I need to be affected.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: [SOLVED] Slow Motion

Post by grump »

TRI99ER wrote: Sat Aug 21, 2021 11:02 am I don't need modifying global dt, because I don't want all my UI etc. to be slowed down.
You're not "modifying" global dt. You pass a scaled dt to world.update to make physics (and only physics) go slower. Your solution with scaling imput velocities is not actually slow motion because the simulation remains unaffected, e.g. gravity.

That's not bad practice; it's the correct solution if you want "real" slow motion.
User avatar
Gunroar:Cannon()
Party member
Posts: 1136
Joined: Thu Dec 10, 2020 1:57 am

Re: [SOLVED] Slow Motion

Post by Gunroar:Cannon() »

TRI99ER wrote: Sat Aug 21, 2021 11:02 am
The solution with "dt2 = dt / 2" is also not ideal, because it would mean I would have a second global tick variable, which would be updated every tick for no reason. Instead I created a variable, that is not updating every tick and just represents time dilation. It's only modified whenever I want to slow down or speed up time and it's multiplied by the velocities of things, which I need to be affected.
Yes, your solution is still good and clean, it's just what pgimeno said was phunny :P
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 4 guests