Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / problems with jumping, and no I dont need to have the whole thing done for me

Author
Message
GOD
21
Years of Service
User Offline
Joined: 23rd Apr 2003
Location: right there
Posted: 17th Jun 2004 02:27
Hey, im having some problems with my jumping code. I have searched through the form, and unfortunatly none of the things I found seemed to help. Right, this is my problem. I have gravity code and it works perfectly.


This works fine and is in its own function (I changed it so it would make more sence, but the function uses (Pull,object,matrix).)
Now i then went on to make jumping code which is this:
Now the problem with this is it is very jery, and the acceleration of the jump doesnt slow down when it nears the peak of the jump, it just changes direction instantly. How would you all sugest I fix this problem? Thanks for the help
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 17th Jun 2004 02:40
Hi...

If you have the basics gravity implemented in your code you do the same thing as would happen in any falling objects, namely that gravity starts to reduce a jumping object's speed by it's gravity factor the moment it leaves the ground. This models the exact thing that happens in nature, ie, first year physics and all that.

Once gravity has applied its "drag" to the speed of the upward movemnt, the character will sloow, change direction, then accelerate to the ground.

S.

Any truly great code should be indisguishable from magic.
GOD
21
Years of Service
User Offline
Joined: 23rd Apr 2003
Location: right there
Posted: 17th Jun 2004 04:00
unfortunatly, thats not what is happening in my program. I have them in diferent functions, the jumping and gravity, so i will try combined them to see if that helps.
GOD
21
Years of Service
User Offline
Joined: 23rd Apr 2003
Location: right there
Posted: 17th Jun 2004 05:58
ok i got things working, sort of. I now have it so the character will jump up, and smoothly come back down. The only problem is that it will do one jump exactly as I want it to, but then the next jump will be very small and sketchy, and then it will have a regualr jump, then a bad one. It repeates this over and over and i dont know why. I went over the code many times and cant see whats doing it. Im probobly doin somthin obviously wronge and im just missing it, but I would appreciate the help. Heres the new code, I rewrote it completly because the other way just wasnt working.


Thanks
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 17th Jun 2004 07:51 Edited at: 17th Jun 2004 07:56
Hmmm...

Well I would have implemented it as something like this;



In this code, height is your present acceleration vertically and high is how far off the ground you are at any moment.

S.

Any truly great code should be indisguishable from magic.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 18th Jun 2004 00:14
I don`t see you reset the height# value when the object reaches the ground again, or is that bit of code left out?, try printing the values at the top of the screen and see what is happening that way.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
GOD
21
Years of Service
User Offline
Joined: 23rd Apr 2003
Location: right there
Posted: 18th Jun 2004 06:29
That was it menter, thanks a lot. I knew i was just missing somthing minor. Thanks for the help everyone.
Hop a long
20
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 19th Jun 2004 00:15
Oops! Looks like I've arrived after the fire is out. Any way here's my two cents worth.http://www.geocities.com/hifin2003/matrix_jump.html

Login to post a reply

Server time is: 2024-09-22 13:28:15
Your offset time is: 2024-09-22 13:28:15