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 / Smoother Gravity

Author
Message
Lavalord7
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 1st Dec 2008 03:35
Would there be a way to make this gravity code smoother? The gravity is mostly in the functions CheckGravity() and LevelSlidingCollision(). You need the sparky collision dll for it, by the way. I'd appreciate any help. The media is attached.



Attachments

Login to view attachments
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 1st Dec 2008 14:21
Gravity is an acceleration more than a velocity. In your code, you are affecting the player's Y position by subtracting a constant, when really, you should be subtracting a velocity variable, which constantly increases by the gravity's value.

For example:

grav = 1.0

inc velY, grav
position object Player, x#, y# - velY, z#

DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 2nd Dec 2008 02:43 Edited at: 2nd Dec 2008 02:43
Zotoaster is right about that. I would recommend doing somthing like this.




DBPro, limited by the programmer.

Login to post a reply

Server time is: 2024-09-27 22:29:37
Your offset time is: 2024-09-27 22:29:37