Hello,
First of all, my question isn't really specific to C# or XNA, but my code examples will use these. Also, sorry for the title, I didn't know how to express my question properly.
I am currently trying to make a Pong clone and I've run into a problem with collision-detection.
Each object basicly has a specific Velocity(which is a Vector2), Position(Vector2, also) and Speed(just a float). On every Update() call of the object, the position is changed this way:
Velocity.Normalize();
Position += Velocity * Speed;
At first, I only checked if there currently was a collision between two objects with a simple Intersects() call from the rectangles of the objects. I quickly realized that I couldn't only check if the object was currently colliding with another, but rather if the object collided with an object on its way. Only checking if two objects were currently colliding made the ball go through the paddle when the speed was too high.
I tried different things to fix the problem, but none of them seemed to work. I only need a way to check if two objects collided on their way, and if they did, if it was from the horizontal, vertical or both(to change the ball's velocity accordingly).
I don't necessarily want the solution right away, maybe just the basic idea of how to implement this, and I'll code it myself.
Thanks for your time.