Game Development Reference
In-Depth Information
The damping of a spring is defined using
F d = L ( v 1 - v 2 )
where L is the damping constant and v 1 and v 2 are the velocities of the
two point masses at each end of the spring.
Now at each time step the acceleration, velocity and position of each
point mass are calculated according to the classical laws of dynamics.
Each point mass is acted upon by a force which is a combination of the
effects of external forces, usually just gravity for a real-time application,
and internal forces due to the springs and dampers. The aim of a
simulation is to solve the location for each point mass effected in this way.
Since each point mass has an effect on the other masses, we need to use
numerical methods to solve what is called a differential equation. The
simplest method is called Euler's method, after the famous mathema-
tician. Euler's method is quick but prone to error unless the time interval
is very short. Creating robust physical simulations is beyond the scope of
this topic, but some of the references at the end should provide a useful
starting point for those interested in extending their knowledge into this
cutting edge area.
Physics simulations are computationally demanding but can often be
effectively pre-calculated. This involves a slight delay on loading. The pre-
calculation stores the final position of a mesh at each time step.
Displaying the mesh is then just an exercise in displaying the correct
mesh for the current time.
Using globally shared resources
As we have seen, some resources should be available globally
throughout an application, while others can be set to object level. A
central character that appears in the same costume throughout an
application is ideally suited to be a global level resource. A single prop
that only ever appears if the animation arrives in a particular scene
under a certain combination of conditions is suited to be an object level
resource. Choosing which resource is available globally, which at the
scene level and which at the object level is something of an exercise in
guesswork. The aim is to cut down on load times and minimize memory
use from the main memory and from the graphics card. With today's
(April 2000) graphics cards offering at least 32 MB of memory, such
considerations are proving less necessary than when graphics cards
had only 4 MB on offer. Nevertheless, careful use of such resources
Search Nedrilad ::




Custom Search