Allright, I don't want this project to end so...
Another way to calculate the height, without using Sparky's DLL is this:
You take a pretty high value (higher/lower than any point on your world) for maxRange# and minRange#.
I take px, py, pz as Marvin's coordinates on the world
Height# = maxRange# - intersect object(WorldObj, px#, maxRange#, pz#, px#, minRange#, pz#)
Assuming you are on the world ofcourse, else the height would just be maxRange. Also, make sure you don't include the py in the command. Also: minRange# would probably be a NEGATIVE value.
To calculate the gravity, you could use a little of physics to achieve the effect. Create a separate variable to store the speed in the y direction, and a constant value for gravity to decrease your y speed.
Here, I take yspeed# for that variable
jumpForce determines the height you can jump.
if jumpkey = 1
if jumping = 0
jumping = 1
yspeed# = jumpForce
endif
endif
`Handle jumping
if jumping = 1
yspeed# = yspeed# - gravity
py# = py# + yspeed#
if py# <= Height#
py# = Height#
jumping = 0
endif
else
`When not jumping, align with the ground
py# = Height#
endif
I know it's not tested, but you get the main idea.
To determine the height of the jump: JumpHeight = JumpForce / Gravity
(v0 = JumpForce, g = gravity => v(t) = -gt + v0 => Y(t) = (-g/2)t^2 + (v0)t
The top of this parabolic function is -b/2a = -(v0)/(2*-g/2) = (v0)/g )
I shouldn't add this, but just so you know it is an exact value.
[EDIT] I am using vista, and it runs just fine on my computer...
It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.