[ODE] Loading trimesh from file
kwizatz at aeongames.com
Tue Jul 11 09:15:03 MST 2006
You have to load the model "manualy" and arrange the triangles into a
vertex array, a triangle index array and a normal array(optional), then
feed the triangles to ODE using dGeomTriMeshDataBuild.
That said, it is probably NOT a good idea to do this for large
"buildings", or for meshes that have too much detail, if say inside your
you have a model of a plant, complete with leaves, base and all, doing
per triangle collision tests on that mesh alone is going to cost a lot of
CPU cycles, which results in lower frame refresh, and the simulation is
likelly to slow down, instead use a bounding box for collision, while
still rendering the detailed model.
As for the character question, same answer, forget about using a
trimesh, use a proxy object instead such as a box, sphere or cylinder,
there isnt much for using Cal3D with ODE, you just use one for caracter
animation and rendering and the other for physics, basically set a ODE
proxy object for the character, advance the simulation, get the new
position and rotation for the object from ode, and render the character
with those coordinates.
Ecker, Bryan R wrote:
> Hello everyone,
> I have a couple of noob questions for you that hopefully will be an
> easy answer.
> I am trying to load up a gaming area (which is an .osg building model
> with all the interior done up), and I want to put a player in it.
> Naturally I don't want the player to walk through walls or drop
> thorugh the floor - So I assume that I am to build the building geom
> as a trimesh. (To get things started, I had originally just made an
> infinite plane at ground level, but of course, I can still walk
> through walls).
> I hate to sound dopey, but I'm finding the documentation on trimeshes
> really confusing. I also checked out the sample test_moving_trimesh
> source, and I'm just not getting it. Plus I'm loading a area from a
> model file, while the sample hardcodes trimesh data within the code,
> and I don't see how to correlate that to reading a model file.
> Are there any samples out there available that I can use as a tutorial
> for loading in a building (or any gaming environment) and making it
> solid? Any other pointers?
> Another quick unrelated question: Has anyone worked ODE with Cal3d?
> I'm using a capsule as a bounding shape for my Cal3D character, but I
> know it could be better. I'm wondering if its possible to use a
> trimesh on the character and have the mesh move as the character moves
> - anybody have any tips, pointers or sample code to pull that off?
>ODE mailing list
>ODE at q12.org
More information about the ODE