Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector2 pos = ball.position;
- Vector2 prevPos = ball.previousPosition; // You'll have to keep track of where the ball was 1 frame ago.
- for (int i=0; i<COLLISION_PRECISION; i++)
- {
- Vector2 testPos = lerp(prevPos, pos, i/COLLISION_PRECISION);
- if (PointInsideRect(testPos, paddleRect))
- {
- ball.position = testPos;
- // Do any collision reactions
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement