[ODE] trimesh and making your own mesh
Aras Pranckevicius
nearaz at interamotion.com
Mon Jul 21 04:54:01 2003
> but if I wanted to represent object as a TRIMESH .. what about collision?
> if there is no trimesh-->trimesh collision detection then I guess trimesh
is
> really only useful for representing the land geometry right?
There is trimesh-trimesh collision detection (eg. that's what OPCODE does -
it gives you back pairs of intersecting triangles). The hard question is,
what to do next... For physics (like ODE), you have to find the contact
point(s), normal(s) and penetration depth(s) from that, and it's really not
that easy (impossible from the intersecting triangles alone).
Of course, for games, where physics isn't widely used, people usually come
up with some (relatively) simple collision response, and have mesh-mesh
collisions...
> I reply to messages before I read it all.. so I guess im right.. in that
> case is there any example
> code out there showing how to concert say.. a BSP map into a trimesh ?
(assuming you mean BSP in general, and not Quake* specific BSP map):
BSP itself doesn't describe the mesh - it's just a spatial partitioning
structure. So a phrase "BSP to a mesh" really misses lots of needed
information, and isn't ODE specific.
(assuming you mean Quake* specific BSP):
Again, it's totally offtopic as far as ODE/tri-mesh is concerned.
But for that situation, if you use BSP for the level, you already know how
to convert it to triangles (you do convert to triagnles for rendering). So,
take the code that processes BSP and generates (visible) triangles; and
throw out any visibility stuff (that is, PVS, frustums, whatever that might
be) - that is, convert whole level to triangles. Voila, you're done :)
Aras Pranckevicius aka NeARAZ
http://www.gim.ktu.lt/nesnausk/nearaz/