I'm trying to test some different types of collision detection. I've come across a problem when I try to do things with picture boxes.
I want to make it so the two floating picture boxes collide with eachother and bounce away at pre-determined angles. The problem I'm having is that my comparing statements don'twork properly.
Example:
If box1.Top < (box2.Top + box2.Height) Then
vmom = -(Math.Sin(90) + vmom) 'vmom is the vertical momentum
I think my problem is that I am comparing every value on the axes instead of just the coordinates and length of box2 (if that makes any sense). When I run it, box1 bounces off of every point where box1.Top < (box2.Top + box2.Height) is true. I have if statements for the other sides of box2 as well, they all have the same problem.
I'm running on VB.net 2003, any help would be greatly apreciated.




Reply With Quote