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.

Dark GDK / A simple ball game - need help

Author
Message
Manjaro
15
Years of Service
User Offline
Joined: 3rd Sep 2009
Location:
Posted: 3rd Sep 2009 14:20
Hey everyone.

I recently downloaded Dark GDK and now I am attempting my first real game. Its a relatively simple ball game with a user controlled paddle. Ive attempted some pretty basic physics so that the ball rebounds in a some-what realistic way. Furthermore Ive made a gravity like affect so that the ball doesn't just 'float' around.

Now the problem I'm having is that the dbMakeObjectBox (the paddle) is going through the dbMakeObjectSphere (the ball) if you move upwards too quickly. Also when the ball bounces on the paddle it eventually just falls straight through it!

You help would be appreciated.
Cheers.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 3rd Sep 2009 16:20
Don't use the internal collision detection. Use sparky's. do a forum search.

Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 4th Sep 2009 00:40
Sparkies is a better collision system, but I doubt that it will fix that particular problem, as its related to how you have it setup.

The trick is, that if your objects are moving quickly, it means that they are moving further each loop(the object doesnt move smoothly like it looks, it "jumps" in incrememts, in a similar manner to how a film displays).

Now, keeping in mind that you are only detecting collisions once per loop, and that the objects are moving(jumping) further each loop the quicker they move, when they start to move really quickly, and the balls appears to fall through the paddle... it isnt.
The 2 objects will simply be jumping past each other before any collision is detected.
The eaiest way to fix that kind of behaviour is to limit your object's movement, so that it cant move more than a specific speed, perhaps slowing it right down when its a certain distance from the paddle(like almost ontop of it), just to make sure it detects the collision properly.

If it ain't broke.... DONT FIX IT !!!
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 4th Sep 2009 11:08
Alternatively, if there is no way you can slow it down, use a system that has support for continuous collision detection, such as physX.

Login to post a reply

Server time is: 2024-11-20 15:37:49
Your offset time is: 2024-11-20 15:37:49