What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
I have a strange collision detection problem…
A maze of balls ( rows & colums ) and a ball i firing on it.
When the speed of the fired ball is to high i get some strange display results.
the ball overlaps another ball in the maze en that is not entirely correct. They should be stacking like a bubbleshoot game.
Everything works as it should be when i use a low speed for the fired ball.
For the collision i loop the entire maze with the fired ball en when a collision is detected i use a break statement because there is no point in continuing to look for collisions…
Can anyone explain why i get odd result with higher speeds?
Well yeah, it’s probably because you’re checking for collisions every frame, and a frame is short enough for two balls, given their speeds, to overlap significantly.
There are algorithms for finding out the exact time a collision would occur, and thus prevents the event of any overlapping by forwarding to the next collision.
Billiards simulation tutorials are a good place to start.
As a side note, I don’t recommend simply upping the frame rate.
I can’t find the site I’ve been using recently…
Here we go (collision detection):
if you have never done vector math or dynamic collision here is a great tutorial to get you started on:
and this is the relevant section for this:
Are you using an overlap based collision system (in the case of balls, for example, checking if the distance between balls is less than their combined radii)? If so, then once the ball starts moving faster than that distance, it’s possible to overshoot a collision or pass through too far and have the collision reposition the ball I the wrong place. Also, sometimes, if you’re using a single loop and returning after it detects a single collision, it’s possible sometimes for it to find a collision within the balls trajectory, but for that collision not to be the closest actual collision, just the first one you encounter in your loop for that frame.
You should post the relevant code so people can try to figure out exactly what’s going on, though, since the problem might be something completely different depending on how you’ve set it up.