The collision between a ball

and a projection wall surface

changes only the velocity vector component along the normal direction at the point of collision

on

. Before the collision, if the ball's velocity vector is

and the unit normal at

is

, then

can be written as

where

and

. After collision, the velocity vector becomes

. If the projection wall surface

is a plane, then determining an accurate collision point

is easy; but if

is curved surface, this can be somewhat time-consuming and yields little benefit since the ball's radius is relatively small when compared to the simulation region. Therefore to calculate more quickly, we simply use the sphere center's coordinate

and a

that is obtained by solving the equation

as the point of collision.
When a ball hits more than one wall at once, we treat the multiple collisions as follows: if all walls are planes, we write

and change it to

where

or

according to which collision happens along the

direction. If a wall is a curved surface, then we first deal with the collision on this surface alone using the method described in the previous paragraph and then deal with the remaining collisions on the plane walls.