• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Need A Mathematic Graph for this

Status
Not open for further replies.
Level 15
Joined
Oct 29, 2012
Messages
1,474
Well I need a graph for this mathematic function .
It's related to a jump system .
Constants :
  • Set g_Acceleration = 981.00
  • Set t_TimeStep = 0.03
  • Set h_JumpHight = 300.00
Well If a player presses up
  • Set x = 1000.00
So When x = 1000 this function runs
  • Set x = (x - (g_Acceleration x t_TimeStep))
The Unit will be moved by this :
  • Set _tempPointDXD_2D = (Position of Jumper)
  • Set JumpTempPoint = (_tempPointDXD_2D offset by ((0, (X x t_TimeStep)))
This moves the unit :
  • Unit - Move Jumper instantly to JumpTempPoint
When the jumper reaches the ground :
  • Set X = 29.43
Can you give me a possible graph for this Oo ?
 

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,121
AMBULANCE.jpg

ambulance here!
anyway, you can use calculator perhaps?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Dude what.

You shouldn't use mathematics if you don't understand it, you'll only end up confusing yourself and those trying to help you.

From what I understand, you're trying to make a simple 2D jump system, and you're struggling with the exit condition.

With those values you are using, the jump will be done in 0.06 seconds.

Try these values:
InitialVelocity = 10 . . . . . (at 33 iterations per second, this means the starting speed is 330 "warcraft speed")
Gravity = 1 . . . . . . (so it will take 10 iterations to reach the top of the jump, and another 10 iterations to reach the ground, so the jump will take 0.6 seconds total)
 
Level 5
Joined
May 6, 2013
Messages
125
Hard to believe that, after 20 posts, nobody posted a simple graph. I, for myself, suck at maths, but i am at least good enough to type functions into a calculator (or for that matter, wolfram alpha), so here is my try:

x: f(x) = f(x-1) - (k*kt)
y: y(x) = y(x-1) + f(x)*kt
-----------------
f(x) = 1000 - kt*k*x
y(x) = c1 - 1/2 * kt*x*(kt*k*(x+1) - 2000)
with c1 being the initial y value of that unit (probably 0 i guess), and the x from y(x) increasing by 1 every time you calculate (probably every 0.03 seconds), k being 981 (acceleration) and kt being 0.03 (TimeStep).

attachment.php


With its maxima being located at x ≈ 33.48 and y(x) ≈ 495, reached after 34*0.03=1.02 seconds,
and the roots being at x=0 (douh) and x≈66.958, reached after 67*0.03=2.01 seconds.
A 2 second jump seems a little bit long imho. Anybody seeing any mistakes i made?
 

Attachments

  • save.png
    save.png
    20.1 KB · Views: 128
Status
Not open for further replies.
Top