Three dimensional rigid body physics simulation engine