Hello all. I’ve got a game program I’ve been working on and there is some balls bouncing around on the screen that’s velocity x and velocity y could possibly be faster than it’s width and I need to tell if it will collide with a point between one cycle of animation and the next.
For instance, below X is the ball and * is the point.
X-----*-----X
In the first cycle, X is to the left of the point and then next cycle X is to the right, so I’d like a forumula that somehow calculates the difference and tells me if I should have bounced off of the point instead of went through.
Like:
If (ball passed through point) {
//reverse velocity
}
It’s only an X/Y point I need to figure out right now. I’ve found code that figures out ball vs ball collisions and have modified that for an X/Y point, but if the ball moves too fast it goes right through. Thanks for any help on this!