layman lerp info

Discussion and feedback on Construct 2

Post » Thu May 10, 2012 2:04 pm

Hi all, I am looking into creating a variety of different objects that home in on different targets depending on certain variables anyway it was suggested that lerp might be a good way to do this. But sadly i know very little about using it.

Can anyone point me towards any info for the layman about lerp, that i can use to get started with the concepts :)AJTilley2012-05-10 14:04:25
B
25
S
7
G
5
Posts: 185
Reputation: 5,056

Post » Thu May 10, 2012 2:20 pm

I found this post helpful to get an understanding of the concept: http://www.scirra.com/forum/lerp-clarification_topic48641.html

I also found this external post useful: http://forums.create.msdn.com/forums/p/45626/272505.aspx

I hope those help.Wastrel2012-05-10 14:23:39
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Thu May 10, 2012 2:21 pm

Lerp(start, end, t)
Its something like:
objects variable= move
object set position to lerp(object.x, target.x,1-0.5^dt), lerp(object.y,target.y,1-0.5^dt)

That tells the object that while its variable returns true, set its current x to the distance between it, and the target every 1-0.5^dt ticks.
So if its last x was 0, then its next x might be 1, because you are referencing its current x, rather than a static point.
If you were to say set x to lerp(1,10,1-0.5^dt), it would go to the distance between 1 and 10 divided by about 0.6, or half, say about 5.5.
If the t value were 0.9 it would go to about 9.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767


Return to Construct 2 General

Who is online

Users browsing this forum: Televangelist, Yahoo [Bot], Zebbi and 3 guests