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: 153
Reputation: 1,272

Post » Tue Sep 06, 2016 2:33 pm

I thought DT already took time scale into account.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

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
172
S
50
G
183
Posts: 8,440
Reputation: 115,599

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: 153
Reputation: 1,272


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests