Physic3D

The beginnings of a 3D physics engine!

Daniel Lowengrub

Physic3D is my first attempt at a 3D physics engine.  So far I've made a 2D engine in order to get a feel for the basics and I hope to start the 3D version this week (8/10/06).  Here i'll record my progress.

Date 8/10/06:

screen shot from 2D engine: (the blue

lines are collision normals)

Today I'm just finishing the initial planning before i start to code.  A few days ago the Matrix and Vector classes got finished up so now everything seems ready.  for the physics i'll use the same basic equations and integration that i used in 2D and for the collision detection i'll use SAT both to detect collisions and to get the collision features.  First of all i'm going to implement the SAT then the physics.  The SAT (seperating axis theorm) goes something like this:

1) get all the direction vectors and there lengths (extents) of the two bodies - now i'm using OBBs so there're 3 directions for each body.

2) loop through all potential seperating axes (the potential axes are the direction axes of each body and all the cross products between the direction axes) and find the absolute length of the projection of each of the direction axes onto the axis.  If the sum of all the projections of both of the bodies is greater than the projection of the vector going from the center of one body to the other then the bodies are colliding,  if not then they're not.

3) if we went through all the seperating axes and didn't find a seperating axis then find the axes were the difference between the total projection of the bodies and the projection of the connecting vector is the smallest.  then the seperating distance is this difference and the collision normal is the potential seperating axes (that we now know doesn't seperate)

4) to get the collision points check which features on each body are at a right angle to the normal.  if no faces like this are found then look for edges that are both perpendicular and have a vertice that is the lowest one along the normal, if non of those are found then just lok for the lowest vertice.

5) after finding the collision features use them to find the collision point.  this is easily done using clipping.

Date 15/10/06:

Today i've successfully implemented a basic collision test with OBB's using the SAT.  it tells you if you've collided and returns the MTD vector.  in the next few days i hope to implement the collision response.  the first step will be to find the collision points using the MTD.

Now i just have to implement all this!!

Date 12/10/06:

So far I've managed to improve the 3D physics by using impulses.  here'e a movie:

blocks3.avi