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.

DarkBASIC Professional Discussion / 'gravity' problems

Author
Message
mnemonic
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 11th Dec 2012 11:30
Hi!

I'm writing an engine, that is supposed to be open world with object like trees, houses and so,,,, yes, and those are all collidable object.

For the terrain however I've set collision off. It's loaded as a heightmap and relies only on following the countour and uses just math to prevent the player from walking too steep slopes.
As long as the stateObjCol equals 0, meaning no collision will tell the application to use the 'follow countour' routine and that routine works satisfying. ยจ
The problem comes when stateObjCol equals 1. Please look at this code,,,




When there's no collision I want the variable get back to 0. I've already tried to check if Collide equals 0 to simply switch back the variable to 0. And the same tries have been done by casting a ray straight down, but the effect of this is that the player moves up a down rapidly as soon as collision occours,,,

Best!

www.memblockgames.com
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 12th Dec 2012 22:30
I can't really pin point the problem based on the small piece of code you've provided but I would suggest you just reset stateObjCol to zero before you do the collision detection so something like:



This way if there is no collision, stateObjCol will always equal zero.

Login to post a reply

Server time is: 2026-07-07 17:27:59
Your offset time is: 2026-07-07 17:27:59