Page 1 of 1

About collision detection

PostPosted: Sun Apr 04, 2010 5:16 pm
by Thanx
I remember those good old, oh I mean bad old :lol: glitches with the collision detection, when an actor leaped through another, when the one was supposed to bounce back from the other.
I know that GE's collision detection is by the pixel, I remember reading that somewhere. Now I don't have the codes for GE, but based on its behavior I suspect that the collision detection first tests the actors' bounding rectangles, and then does further detection to the pixel, to sort even preciser. I can also imagine, that it uses only the outmost pixels of the different sprites, for detection, to further speed the process.
Now my idea is, that to prevent the bug to happen: when using rectangles at highest level: The rectangles the engine should use, should be not only the one the actors are currently contained in, but also, they should contain the space the actors went through, since the last collision detection. That way, if the actor was going so fast, that within a frame, it jumped over the obsticle, the engine says: Hey, now you just go back to that obsticle, and go in the other direction!

So if the actor is contained in a 10px by 10px rectangle, and is going at xvelocity = 75, heading towards a 10px obsticle, then the rectangle for speedy, is actually, as wide as 85px, to include everything the actor has gone through. That way the engine realizes, that there are intersecting rectangles.

Now at that point it won't detect anything again, because the obsticle is only 10px. So I say, that the actor's body should also be stretched. In such a way, if it let's say, a ball, then half of the curve is left in the point the actor was originally, then for the next 70 or so pixels the pixels are all considered the actor's, and then at the last pixels, is the remaining part of the curve that would make the circle round.

I hope that can help, and once be used... It was just an idea, as I was working around on the computer :)

Re: About collision detection

PostPosted: Sun Apr 04, 2010 7:25 pm
by makslane
Thanks!

Re: About collision detection

PostPosted: Tue Apr 27, 2010 9:06 am
by chrisevil
=P yeah I have noticed that it isn't always perfect but uh...

I never really got what you were saying?

Re: About collision detection

PostPosted: Tue Apr 27, 2010 1:39 pm
by Hblade
Yeah, it would be an awesome feature to enable a different method of collision detection.

Also if you can, fix up the "ChangeAnimation" thing so that even in draw actor it doesn't repeat the action.

Example:
Code: Select all
ChangeAnimation(bleh bleh... REPEAT); where repeat can be yes or no :3