Physics - Equations Model

See this page for introduction to this approach

Modeling Motion

You could offset or move the object with the following type of method:

Boolean isInside(float x, float y, float z) {return shapeToBeMoved.isInside(x+xOffset, y+yOffset, z+zOffset);}

Modeling Forces

We could deform a shape by changing the parameters of an equation, for example we might model a muscle, which changes shape depending on a parameter 'contraction' as follows:

boolean isInside(float x, float y, float z) {return ((r*r < (x+contraction)*(x+contraction)+(y+contraction)*(y+contraction)+z*z);}

Collision detection

Then collisions could be detected by cycling though all values of x, y and z. Then checking if for a given set of x, y and z, if more than one objects isInside method returns true then the objects are trying to occupy the same space.

The scene graph could be generated, every frame, by feeding these equations into a mesher.

At first sight this may seem horribly inefficient, with lots of very slow bits of code like this:

for (x=-100000; x<100000;  x=x+0.001) {
 for (y=-100000; y<100000; y=y+0.001) {
  for (z=-100000;  z<100000; z=z+0.001) {
   ...
  }
 }
}

but I'm not sure its as bad as that, I think there could be tricks to make it more efficient, for example areas of space nearer the camera could be scanned at closer intervals than more remote parts of space.

Collision response

This might be done in the meshing method, for instance individual verticies could attract each other (as in metaballs) or they could repel each other (Relaxation Methods)


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 3d Games: Physics -

 

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-2015 Martin John Baker - All rights reserved - privacy policy.