wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > -- Submit A Tutorial --
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 09-07-2009, 09:40 PM   #1
Idontneedaname
User
 
Idontneedaname's Avatar
 
Join Date: Nov 2008
Posts: 61

Submissions (1)

Idontneedaname has little to show at this moment (6)

Default Parables

Parabels how to?

Because I saw lots of threads about this question, I wrote this little tutorial about the parabolic formula of a jump.

You have to know that there is not only one formula, but quite a lot of them depending on the given parameters you put in.
You could define a parable by a maximum height, the height difference between target location and start location and a given jump-time.
But I think that this solution is not realistic. If some guy jumps even the shortest distance in 2 seconds, but also needs 2 seconds from one end of the map to another, it would be weird.
I prefer instead to take the movement speed of the jumping unit, from which you can calculate the complete parable.
This way, that's the data we can use:
1. Movement speed
2. Height difference
3. 2D-Distance (just like on a map: two points connected with a lineal, no height difference included)

Paid attention in Physics? The formula for the vertical throw is this one:

y(t) = -0.5 * 9.81m/s * t + v * t

We have two unknown parameters here: t and v
The first one is easy if you look at this picture:

Click image for larger version

Name:	Parabel.jpg
Views:	46
Size:	18.0 KB
ID:	45510

(yeah it's paint)

The unit will move in x-direction as it did before. With its normal movement speed. Which means that the jumping time is:
t = Distance/MovementSpeed

v (which is the ascending arrow) is the last unknown. We take our formula and transform it a bit:

y(t) = - 0.5 * 9.81m/s * t + v * t becomes
v = ( y(t) + 0.5 * 9.81m/s * t ) / t

We know that the unit will have a higher position at the end of the jump. y(t) is nothing but height at time t, so we can replace the y(t) by the height difference:

v = ( HeightDifference + 0.5 * 9.81m/s * t ) / t

Calculate v and put it into the old formula.

In the trigger, make sure that the unit keeps it movement speed:
Polar Offset by (Default ms of unit) * periodic time
and
set height to -0.5 * 9.81m/s * t + v * t (Z of temporal position of unit Z of startposition of unit)
Remember, it's height at time t, so the t here is NOT the time the units needs for the complete jump, it is the time the unit is already in the air.
The last one for providing a smooth jump, it would act strange over cliffs otherwise.

Note: 9.81m/s is far too low for warcraft usage. There is nobody who would jump 700 metres or so. I am using 981m/s.
Note2: This will also work if the unit jumps down from a higher level.

I have added a example map which leaks and is not smooth over cliffs. It does, though, show the formula in action (Download). Enjoy!

Have a nice day!
-Idontneedaname
__________________

Thanks to Neonex for the idea.
Idontneedaname is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 06:40 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services