[ODE] ODE meets Quake2 derivative using BSP collider
trebor_7 at gmx.net
trebor_7 at gmx.net
Wed Mar 30 14:31:24 MST 2005
Hello people,
This is my first post here!
I integrated ODE into my QRazor-FX engine. I run ODE only in the server game.
I call G_RunFrame 5 times in one network frame with a step size of 0.02
seconds to achieve a stable simulation, that means the server game runs with
50Hz and the network with 10Hz as in Q2/Q3A.
I've started to write a native BSP collider. It traverses every geom's AABB
and tests it against the BSP leafs, then against the BSP leaf surfaces and
then against the BSP leaf surface triangles and creates the dContacts.
I have implemented successfully BSP<->Sphere collisions and I get more stable
results than using ODE's native trimesh support with OPCODE.
I designed the BSP geom interface like any other so it should be not a very
big problem to patch the vanilla ODE code with the BSP geom support.
The BSP collider allows material properties on each surface which is an
advantage because if you upload one big trimesh per BSP world model, then you
will loose all surface properties like slick, bounce, playerclip et cetera
which affects gameplay badly.
The current interface for it is:
dGeomID dCreateBSP(dSpaceID space);
void dGeomBSPSetLengths(dGeomID box, vec_t lx, vec_t ly, vec_t lz);
void dGeomBSPAddPlane(dGeomID g, vec_t a, vec_t b, vec_t c, vec_t d);
void dGeomBSPAddNode(dGeomID g, int plane_num, int child0, int child1);
void dGeomBSPAddLeaf(dGeomID g, int surfaces_first, int surfaces_num, int
brushes_first, int brushes_num, int cluster, int area);
void dGeomBSPAddShader(dGeomID g, int flags, int contents);
void dGeomBSPAddSurface(dGeomID g, int face_type, int shader_num, const
std::vector<vec3_c> &vertexes, const std::vector<index_t> &indexes);
void dGeomBSPAddLeafSurface(dGeomID g, int num);
As you can see my interface is not in pure C and I used the STL in ODE
internally because I use a fork anyway. I replaced the math core code with
mine and I changed the public interface a bit e.g. dReal has become vec_t
which existed already in Quake. I also changed the creation of dContacts to
avoid redudant contacts which requires to change every collider in
collision_std. :/
http://xreal.sourceforge.net/files/ODE-BSP_Sphere-Collider.avi
This video demonstrates ODE BSP<->Sphere collisions and Sphere<->Sphere
collisions. The dropped items have a sphere as collision geom and the rockets
aswell.
The ODE fork can be found here:
http://cvs.sourceforge.net/viewcvs.py/xreal/qrazor-fx3/src/ode/
Project website:
http://sourceforge.net/projects/xreal
Cheers, Robert
More information about the ODE
mailing list