• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Parabola ... sort of?

Status
Not open for further replies.
Level 22
Joined
Nov 14, 2008
Messages
3,256
hey

just anyone that got any idea how to calculate a good parabola function and not the usual one, with that I mean not a raise and reach half it goes down.

If anyone is good at math lawl (only going for the first course of 5 in math atm so not so good yet ;) )

to make a parabola that goes like this

example.jpg

straight falling down like rain of chaos basiclly, would be appriciated if someone could come up with this, going to use it for a spell function and ofc I can make it otherwise with dummy spells and such but thought this would be ehum ... better?
 
Level 11
Joined
May 31, 2008
Messages
698
You could also do it by using whatever angle you want. Say you want it to come down at a 45° angle. then you can do tan45 = y/x using makers little diagram. So you could change the equation to set the height y = tan45 * x. You can make it move forward 5 and it will move down to the appropriate height to get a 45° angle to the ground.

Every .02 seconds
Set HeightOffset = tan45 * 5
set height = current height of unit - HeightOffset
Set flying height of picked unit to height at 0 // setting units flying height to a rate of 0 sets its height instantly
move unit to position of picked unit offset by 5 towards facing of picked unit

I think something like that would work.
And btw i dont think getting the distance of z will help at all :/

An easier yet less accurate way to do this could be to simply move the unit forward and do Set units flying height to 0 at 50
 
Level 8
Joined
Jun 18, 2007
Messages
214
JASS:
function JumpParabola takes real dist, real maxdist,real maxheight returns real
    local real t = (dist*2)/maxdist-1
    return (-t*t+1)*maxheight
endfunction

Here's a JASS jump parabola made by Shadow1500. In GUI it would look like:

  • Jump Parabola GUI
    • Events
    • Conditions
    • Actions
      • Set dist = (Distance between (Position of (Triggering unit)) and (Position of (Triggering unit)))
      • Set maxDist = 650.00
      • Set maxHeight = 500.00
      • Set t = ((dist x 2.00) / (maxDist - 1.00))
      • Custom script: set udg_final = ( - udg_t * udg_t + 1 ) * udg_maxHeight
      • Animation - Change (Triggering unit) flying height to final at 0.00


You can set here maxDist - Distance Achived, dist - moving dist, maxHeight - maximum height that unit achieves. I'm not really sure how good is this parabola, but I used it in my spell, and it worked fine. Hope this helps.

THIS IS NOT MADE BY ME. If you use give credit to Shadow1500.
 
Level 11
Joined
May 31, 2008
Messages
698
y(x) = mx + a This might be the easiest way to do it. y = mx + b is more common than what u said i think but its rly the same thing :/
y = the height offset
x = the distance moved forward
m = the slope (rise over run) so -3/4 slope would make it go down 3 and over 4
b = the starting height
 

Rmx

Rmx

Level 19
Joined
Aug 27, 2007
Messages
1,164
There is also another one.

You have -

Height = 300
Distance = 1000
Speed = 10

The formula when you reach distance 500 is ..

Set Height = Height - X.

X = ( ( Speed / Distance ) x Height )

Best and most lovely :D

Remember when the hero reaches half distance :p
 
Status
Not open for further replies.
Top