View Single Post
  #18  
Old 01-11-2005, 12:45 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

As you suggested, the problem is that there are too many balls. The number of collision tests performed increases exponentially with each ball that is added. This increases the amount of time between each iteration, which in turn allows the ball to poke through the walls.

The builtin timer function actually uses a very accurate time routine, however it is limited by the frame rate of the application.

Here is the equation used to calculate the reflection vector. There are various sources on the internet that go into detailed explanations on how this equation is derived.

R - Reflection vector
V - Incoming vector
N - Normal vector

R = V - (2 * V dot N) N
Reply With Quote