HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Physics of jumping

05-10-2009, 02:41 AM#1
wraithseeker
How do I find them?

I know finding velocity issues is

V = Vi + at
Vi= vf-at
vf = 0

How would I go about doing it? It should not be a vertical jump.

Anybody here has the formula to do the rest?
05-10-2009, 03:16 AM#2
cosmicat
Since it's not likely that the unit will be in the air long enough for friction to matter, assume constant horizontal velocity - it makes everything much easier. Real-life acceleration due to gravity is 9.8 meters per square second - which can probably be approximated at 1000 units in-game.

After that, decide which variables are going to be independent. If you want to keep jump height constant, you'll have movement speed dependent on distance traveled. If you want to keep movement speed constant, your unit will be making shorter jumps to travel shorter distances.
05-10-2009, 03:26 AM#3
wraithseeker
Jump height maximum is constant, unit's movement speed will be constant and acceleration will be constant.

So how do I go about doing it?

1000 for accleration? Isn't that abit too much.
05-10-2009, 03:45 AM#4
moyack
WAIT!!!

you need to make a loop which changes the vertical velocity according to the gravity.

z = zo + vzo*t -0.5*9.81*t^2

yo= GetLocationZ(GetUnitLoc(u))

t is the varaible that we should increase in the looping function

Horizontal velocity is ALWAYS constant.

x = xo + vx*t

xo = initial position of the unit.
05-10-2009, 06:59 PM#5
Anitarf
Quote:
Originally Posted by wraithseeker
Jump height maximum is constant, unit's movement speed will be constant and acceleration will be constant.
In that case, your unit will only be able to jump a fixed distance. A constant max height and constant acceleration gives you constant jump duration and with a constant movement speed you get a constant distance. For a targetable jump spell you need to make one of those values variable.
05-11-2009, 05:50 PM#6
fX_
id get all the forces involved - impressed/movement/effective and internal/drag/gravity - then associate them with each other / sum them up / make it wholesome or w/e.

probably:
firstly, the movement/moment w/e u wanna call it of the moving thing/guy, w/c goes upwards (duh) and towards some horizontal direction.

then i'd make little 'compartments' for each possible 'interacting force' or w/e. so i can enable/disable each 'compartment' independently of the others - say i wanna have a no-gravity and with-drag environment, etc.
and the operations in each 'compartment', corresponding to the influence of the interacting force does that influence for the force on the movement.
interacting forces may be:
gravity,
drag - basically just counters the movement, so this would have x and y components as the movement (which goes up (duh) and horizontally) does, but negative to the latter and at a scale/coefficient or w/e u wanna call it.

i c.b.f with maths ;c
05-11-2009, 07:16 PM#7
cosmicat
Quote:
Originally Posted by wraithseeker
Jump height maximum is constant, unit's movement speed will be constant and acceleration will be constant.
So you want an immediate-order spell, based on something like Wind Walk or Channel, which causes a unit to jump a fixed distance forward?

Quote:
Originally Posted by wraithseeker
1000 for accleration? Isn't that abit too much.
No, I don't think so. The average human being is between 1.5 and 2 meters tall, and the average wc3 unit is around 160-240 units tall. With 9.8 meters as reference, 1000-ish units sounds about right.

Remember, it's meters per square second, so before the first second passes our change in velocity is relatively low. Depending on your chosen fixed velocity, your unit could jump quite high before coming back down.

Jump height is most easily found by taking the derivative of the unit's height and finding when that equals zero.
Collapse JASS:
function GetLocalExtremum takes real a, real b returns real
    // (dy/dx)(a * x - b * x * x) = a - 2 * b * x
    // a - 2 * b * x = 0
    // <=> a = 2 * b * x
    // <=> a / (2 * b) = x

    local real x = a / (2 * b)
    return (a * x - b * x * x)
endfunction

My calculus is a bit rusty, since I haven't done any of it for a year...
05-12-2009, 09:33 AM#8
wraithseeker
Wait, so who should I listen to?

@Cosmicat. What is the recommended value for a fixed velocity?
05-12-2009, 07:38 PM#9
cosmicat
Quote:
Originally Posted by Anitarf
In that case, your unit will only be able to jump a fixed distance. A constant max height and constant acceleration gives you constant jump duration and with a constant movement speed you get a constant distance. For a targetable jump spell you need to make one of those values variable.
This.

Quote:
Originally Posted by wraithseeker
Wait, so who should I listen to?
Anitarf.

Quote:
Originally Posted by wraithseeker
@Cosmicat. What is the recommended value for a fixed velocity?
Assuming you mean fixed horizontal velocity (since I'm still not sure exactly what kind of ability you're trying to make), it makes sense to base it on the unit's movement speed. Try (GetUnitMoveSpeed() * 1.08). Adjust factor to taste. :)

Again, if your spell has a point or unit target, it needs to have at least one dependent variable in it. Try to think of all the variables involved as elements of a system of linear equations. If you define every single variable, you have only one possible solution, which works in exactly one cast. If you leave one free, you get infinitely many (but only along one dimension, so it's still predictable).

Almost every variable in our system can be solved with integrals. Normally, an integral leaves an unknown constant behind, but luckily we're dealing with velocity and acceleration from a known location, so we aren't going anywhere mathematically uncertain.

Unfortunately I have to get to a class right now, and there are more things required of me after that, but I'll try to get a few of the formulas worked out for you later.
05-13-2009, 01:42 AM#10
wraithseeker
Well ok, I'll wait for your other formulas.

The ability I am trying to make is to make a unit fly to location B which is the target location and from location A , unit location.
05-13-2009, 06:50 PM#11
cosmicat
Bah, since I'm lacking time, and since there's a perfectly good resource out there that probably has exactly what you need, I'll just link you to that.