Author Topic: Projectile velocity from one position to the other?  (Read 875 times)

I can't seem to find a good way to calculate velocity of a projectile going from one position to the other. How would I do this?

« Last Edit: November 12, 2014, 04:25:36 PM by Dannu »

If you're trying to find the velocity required to get from A to B within T seconds:

    %delta = vectorSub(%B, %A);
    %velocity = vectorScale(vectorNormalize(%delta), vectorLen(%delta) / %T);

Where do people find the attention-span to remember all of these functions?

integrate the acceleration  :cookieMonster:
« Last Edit: November 12, 2014, 04:38:34 PM by Farad »

If you're trying to find the velocity required to get from A to B within T seconds:

    %delta = vectorSub(%B, %A);
    %velocity = vectorScale(vectorNormalize(%delta), vectorLen(%delta) / %T);

Alternatively, we can do it with fewer vector function calls:

%velocity = vectorScale(vectorSub(%B, %A), 1 / %T);

Where do people find the attention-span to remember all of these functions?

It's just math, not memorization.


Wow, never knew it was that simple.

Tried it as well, pretty accurate for what I am doing.

Where do people find the attention-span to remember all of these functions?

It's not like we sit down with a Torque manual and study. There's only so many times that you can look up vectorScale when you need to multiply a vector before you just remember it. As far as the actual algorithm for doing things, it's a mix of logic and math. forget if I have how to calculate required velocity to traverse a given distance memorized, but if I think for a second I'll realize that V=D/T, so we have to divide the distance by the time. You can get distance with vectorSub(%B, %A), and there's no vectorDivide function in Torque so we'll have to multiply by 1 / time to do the same thing. So vectorScale(vectorSub(%B, %A), 1 / %T).