what are lerp,qarp,and cubic?(for the nonmath)

Post your own tutorials, guides and demos.

Post » Tue Nov 08, 2011 1:30 pm

ok, this is a continuation of the lerp tutorial.
I actually recommend that first so you see the actual numbers changing, and understand it better.

in this, as with most real world cases, you won't see each number, but will see things like objectname.x instead of the actual value, so you see an example application and how it will more likely look in your code.

the red and purple dots are drag and droppable
if you right click and drag any of those dots you can change the angle of that dot.

ep stands for endpoint
cp stands for controlpoint

same as before, use the slider to change the value of t
all cc interpolation tutorial

all the dots start with their angles at 0 degrees, with their red lines facing toward the right of the screen.
you'll notice if you place ep1's angle slightly greater than 0
and you place ep2's angle slightly less, it will go all the way around almost 360 degrees instead of crossing the short distance through 0|360 boundary. though this makes sense because lerp is just going between the numbers 10 and 350, let's say. this is usually not the desired result when working with angles

now try rightclicking on the 'lerp' button at the top. it will change it to anglelerp

the x and y are still lerped, but the angle will be anglelerped.
anglelerp is a function in the math plugin that will assume you want to take the shortest route to a new angle when lerping, so you can safely ignore the 0|360 boundarylucid2013-07-13 19:08:02
Spriter Dev
Posts: 3,283
Reputation: 17,147

Post » Tue Nov 08, 2011 9:56 pm

Qarp is my new best friend. Nice example!

Any chance you could share how you got the dots to be positioned between the start/end points? Are they constantly spawning and being set on a path, or is there a fixed amount and some magic event to position them properly?Tokinsom2011-11-08 23:55:44
Posts: 1,794
Reputation: 19,193

Post » Tue Nov 29, 2011 1:00 am

I think I understand why it works but I don't really know how to apply it. I wanted to make a bullet curve out of the imagepoint to a spot ahead from a top down type perspective. I'm not really sure how to apply qarp to that. Frenchyann had said qarp was the best way :/ Though I think I could use bulletml to make it easy I didn't want to have to go that route :/. Anyone care to explain a lil more or give me an example of a gun firing with these methods without anything extra in it >_<
Posts: 11
Reputation: 1,491

Post » Tue Nov 29, 2011 5:58 am

[QUOTE=amfest]I wanted to make a bullet curve out of the imagepoint to a spot ahead from a top down type perspective.[/QUOTE]
But from a top down perspective it wouldn't be a curve, but just a line.

Or do you mean something like, you shoot to the north while the enemy stands in the east, and the bullet still reaches the enemy? Then just imagine a third invisible spot, that the bullet will head towards on its way to the enemy.

Then its a=start position of the bullet, b=invisible imaginary point, c=enemy's position.

green refers to a and is the start point. Blue is b, imagine it being the point in which direction the bullet is shot at start. red is c the enemy's position and the final point that needs to be reached.
Posts: 1,821
Reputation: 8,289

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests