Ball collision and sweep test
in
Programming Questions
•
2 years ago
Hi
I've been relearning vectors by rewriting my cartesian/trig-based ball collisions as PVectors (like you do).
The result with balls colliding with
- other balls
- stationary balls (here called rings)
- lines
is
here. And I'm really quite chuffed!
![](http://forum.processing.orgzoho-static/ze/images/smile.gif)
I'm considering adding sweep tests (nicely descirbed
here), but am struggling with getting my head round how to do so when the ball colliding with a moving object - in this case a rotating line. The ball "knows" its velocity, but the line's position and rotation are passed to it. So I can tell where the ball will be in the next frame, but I won't (necessarily) be able to tell where the line will be.
Do I
- pretend that the line is stationary and call that good enough
- store its previous position and rotation just in case it's going to hit a ball in the next frame
- rewrite it (though that doesn't really make sense given the type of beast it is)
- or what?
Thanks
1