Physics - Simulation of Mechanical Worlds

How can we build a 3D simulation of physical objects?
3D programs like Java3D use a scenegraph to render to the screen, but should the scenegraph nodes also be used to model the interactions?

Modeling Newtonian Mechanics

To model Newtonian mechanics, we need to be able to do the following things:

Modeling Motion

A scenegraph can be used to model motion, the shapes that are moving could be placed under a transform group and its translation modified each frame. This would need to be coded by the programmer as the behaviors built into VRML/Java3D don't seem to be appropriate, they require start and end points which would not be known in the general case, also these behaviors are not specially good at generating accelerations. In order to calculate these we will need to hold parameters like, energy, mass, linear and angular momentum, c-of-mass, etc. along with the shape information in the node.

Collision detection

To prevent two objects from occupying the same volume of space, we need collision detection. Collision detection is quite difficult for arbitrary geometry arrays (not implemented in Java3D 1.1). This might also be a heavy overhead, if there are a lot of objects and we need to test for a collision between every object and every other object.

Collision response

Then once we have detected the collision, we need to calculate the effect of the collision, generate new velocities, spins, etc. I have tried to calculate the formulae in the collision section, and as you can see, it get very complicated when all objects can have 6 degrees of freedom.

Non Scenegraph methods

So, for the reasons above, although the scenegraph is normally used for rendering, it may not always be the best way to model the physics. Other possibilities are discussed in this section.

Analytical verses Numerical Methods

Should we use analytical methods or numerical methods? Analytical methods require us to solve some complex equations, and therefore require a lot of work at design time. Numerical methods involve less complex equations but more calculation is done at runtime. This is a tradeoff, in the most general case we will probably have to use numerical methods, but in more restricted cases we may be able to build a faster, more efficient, simulation by using analytical methods. So if we put more analysis at design time, we may be able to design the program to run faster.

Rigid verses deformable body interactions

There are different types of collision and it may be more efficient to choose the type of model depending on the application. For instance some applications involve perfectly elastic collisions, where all the energy of the collision is transformed back into kinetic energy, an example of this might be a simulation of snooker or pool. Other applications may involve non-elastic collisions, such as a car crash, where some of the kinetic energy may be converted into other types of energy, in some cases, for non-elastic collisions we may want to model the deformation of the objects, if so we need to model them as non-rigid bodies.

So what types of models could we use to simulate the 3D mechanics? Here are some possibilities I have thought of, I am sure there are a lot more, if you can think of other variations please let me know:

Simulation of rigid bodies

  1. Use scene graph for both rendering and modeling?
  2. Numerical Methods
  3. Model shapes as equations

Simulation of non-rigid bodies

How do we model something that is flexible like, say, a sponge, or a biological system?

  1. Deformable Shapes
  2. Deformable Shapes using Numerical Methods
  3. Finite Element Method and methods using partial differential equations
  4. Model shapes as equations


There are APIs for rendering 3D models, such as Java3D. This document discusses ways to expand these models so that they can simulate the physical behavior of objects. This would allow people to build and exchange virtual models, with physical behaviors, without having to program the physics. This behavior could be an integral part of the object, like its geometry or appearance.

A 'Physics editor' could then be added to allow non-programmers to create solid objects which can interact in virtual worlds.

Uses of 3D mechanics

To find a way to investigate this I will go back to some possible requirements and describe what the end users would see. What I had in mind was a system where people could do the following:

  1. One person might build a model of a solid object in their world, and send it to a second person who could put it in a different world. This object would behave in a way dependent on the physical properties that the first person gave it. For example, if it hit another object it might fall over, it might bounce off it, or it might smash into pieces.
  2. One use might be education, to allow people to do virtual physics experiments. Or to build virtual engineering models such as engines.
  3. Another use might be for people with particular interests/hobbies to try out ideas in a virtual world. Different people could build parts of the world, when they put all these objects together in a virtual world they should interact together. An example might be a war games different people could build a fighting machine separately, then put them all together in the same virtual world and let them fight it out.
  4. Another application might be virtual games/sports, for example pool, golf, football, etc.
  5. This would not just be for multi user worlds. Individual 'authors' might want to get physical objects form other people or buy them off the shelf.


The requirements will depend on the application, some applications might need a very accurate simulation of the physics, other applications, such as games, may just need to look about right. Some applications may need a simulation or the physics properties in earths gravity and atmosphere. Other applications might need to model space, relativity, etc.

It seems to me that for all this to become practical would require a number of conditions:

  1. The physical properties and their interactions should be rigorously enough defined so that objects continue to behave as expected in viewers from different suppliers.
  2. These properties should be defined at a high level of abstraction, so that the viewing engine is free to optimize the low level details to allow efficient runtime performance.

It doesn't seem practical to model down to the atoms & beyond, so this must be a compromise, the physical behaviors must be simple enough to model, yet comprehensive enough to be useful in a high proportion of applications.

metadata block
see also:



Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Physics for Game Developers - Assumes a knowledge of vectors, Matrix and trigonometry (the book has a one page introduction to quatnions). The book introduces Newtons laws but it does assume a basic knowledge physics. It covers Kinematics, Force, Kinetics, Collision (detection), Projectiles, Aircraft, Ships, Hovercraft, Cars, Real-time, 2D rigid body, Collision Response, Rigid body rotation, 3D rigid body, multiple bodies in 3D and particles. (I cant find a general formula for collision response which combines linear and rotation, but there may be something in the code included?). If you don't have the prerequisite knowledge of Matrices etc. you may want to get the Mathematics for 3D Game programming book first.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.