Sample 2D/3D physics code