Lerp with timescale

Get help using Construct 2

Post » Tue Sep 06, 2016 10:20 am

So, I've been using lerp as long as I started with construct 2. I switched to 1-n^dt after reading this, which supposedly gives perfect accuracy without worrying about the frame rate, but it is still obviously time scale dependent. I've tried multiplying by timescale, and other variants, but no luck.

So just being curious, would there be a way of improving even more the "speed factor" of lerp so it would also support any time scale? And would the extra calculations hurt performance if many of these are called compared to the "vanilla" lerp?
B
9
S
3
Posts: 152
Reputation: 1,270

Post » Tue Sep 06, 2016 2:33 pm

I thought DT already took time scale into account.
Mistakes were made.
B
52
S
26
G
110
Posts: 1,620
Reputation: 62,161

Post » Tue Sep 06, 2016 2:43 pm

1-n^dt just approximates the current frame rate, and should give you a constant speed of about 60 frames per second.

But what you are talking about is different speeds of different objects.

The best method for using lerp, and dt would be the speed you wish to move, in pixels per second, times dt.
Most behaviors are setup to use pixels per second btw.
Image ImageImage
B
169
S
50
G
174
Posts: 8,328
Reputation: 110,800

Post » Tue Sep 06, 2016 2:49 pm

Good to know, thanks @newt ! I guess I'll stick with what I have if the formula cannot be improved.
B
9
S
3
Posts: 152
Reputation: 1,270


Return to How do I....?

Who is online

Users browsing this forum: Ashley, dop2000, jatoblendy, MathNook and 30 guests