[ODE] Associating ODE with certain 3D file formats

Jan Kratochvil krata at matfyz.cz
Sun Dec 19 11:38:47 MST 2004


> Forgive my ignorance with ODE , . I have two .3ds object - just simple boxes
> and want to associate some collision detection on these two objects ,  can you
> associate ODE with your own objects ? The examples I've seen build the
> geometry with ODE , is this used like a bounding box around your own complex
> geometry ?
> 
> Thanks

If you want to load 3ds and feed it to ode you have to make some 
decisions. How accurate collisions do you need? I personaly don't need too 
exact collisions so i just load 3ds file and get AABB (axis-aligned 
bounding box) from its subobjects.

this is the essential part of aabb construction. (of course you don't have 
to make aabb and just use dTriMesh (note dTriMesh is my wrapper class 
around dGeomTriMesh c functions.)

    //create vertices, indices
    //i am using lib3ds to parse *.3ds

    ode::dTriMeshDataID new_tmdata = ode::dGeomTriMeshDataCreate();
    ode::dGeomTriMeshDataBuildSingle(new_tmdata, vertices, 3 * sizeof(float), points, indices, faces, 3 * sizeof(int));
    ode::dTriMesh *myTri = new ode::dTriMesh(0, new_tmdata);
    myTri->getAABB(aabb);
    delete myTri;
    delete[] vertices;
    delete[] indices;

now you have aabb (dReal aabb[6]) so you can make dGeomBox 

Jan Kratochvil


More information about the ODE mailing list