Hardware Reference
In-Depth Information
change the collision calculations because a circle is drawn by deining its center point. Also, if
you rely on simply detecting when the position of the ball is greater than the collision limits
you calculated, you will most times draw the ball actually overlapping the line. his will look
like the ball has penetrated into the relecting object. It would be much better if, when you
detect a collision, the position of the ball is adjusted to sit on the colliding surface. his is
shown in Figure 5-5; the ball's position is shown in successive frames, and when the collision
occurs the position of the ball would normally be behind the relecting object. his does not
look good, so it is hauled back to sit on the line. his has the efect of slowing down the ball
at the point of collision, but you do not perceive this as you are expecting a collision to occur
at the surface and the brain's expectation overrules anything else.
Figure 5-5:
Snapping the
ball to the
colliding object.
Search WWH ::




Custom Search