Best way to detect a side collision

BlitzMax Forums/BlitzMax Programming/Best way to detect a side collision

Yahfree(Posted 2008) [#1]
Hey,

I've got a game that requires me to know what side an object was hit on. In order to deflect that object in the right direction.

For example, imagine a cube, you have a ball traveling upward, and you make calls to watch for a collision. Once a collision is made you make changes so the ball travels downward now.

What if we hit that cube on the right side? You of course would want the ball to change its direction from left to right, and not just downward.

So how do I detect the side of a collision?

My idea would be to do a Rects collide check against the object (one for object A. and check on four rects, one for each side)

But in my cases, this leaves odd behavior and bugs.

Any ideas?

PS. my object is a rounded rectangle NOT a square


Perturbatio(Posted 2008) [#2]


Any use?


Yahfree(Posted 2008) [#3]
That helps. It's a rects collide check for each side, similar to what i used before, I'll see if i can work it, as I can't seem to come up with any other methods.

Thanks