Entity from triangleMesh

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

Entity from triangleMesh

Post by grobi »

Hi,
is there a chance of creating an Entity from a TriangleMesh?
For a racing game I have a highdetailed car-Model I want to use for rendering and a very very very rough and simple version of that model that shall be used as collisionshape. I tried to create a ConvexHull from the simple collisionModel but its optimized too much, looks too deformed. Is there something like a DynamicTriangleGroup?

thx Grobi
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Entity from triangleMesh

Post by Norbo »

While you could create a dynamic CompoundBody with a bunch of Triangle entities, you will get exactly that - a hollow shell.

Chances are, you will get something a bit closer to what you want by making a CompoundBody of relatively few ConvexHulls. If you take the ConvexHull of a whole model, it will be one convex blob. If you instead separate it into multiple ConvexHulls, you can maintain the concavity that you want while using maybe 2-4 ConvexHull entities in total.

You can do this approximately by creating a few convex triangle mesh pieces that make up the previous whole. You could just export a few extra approximate sub-meshes. Algorithms exist to do this automatically ("convex decomposition") as well, but are not currently provided directly by BEPUphysics.
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

Re: Entity from triangleMesh

Post by grobi »

so you mean dividin the car-triangleMesh into 4 sub triangleMeshes and build seperate convexhulls from those triangleMeshes and put them into one compoundbody as collisionshape for the vehicle? hmm that could be done from the high res model so I wont need the extra collision model anymore.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Entity from triangleMesh

Post by Norbo »

You could use the high resolution version, but if it is too detailed, you may see some performance loss. Even though it's only a few ConvexHulls, the collision detection systems will be more expensive if each ConvexHull has hundreds of points.
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

Re: Entity from triangleMesh

Post by grobi »

oh I made a mistake...
created a debug drawer for the convexhull of the collision model and it looks really good, just alil bit bigger scaled.
Damn, thought it didn't work coz the collision model had 156 vertices and my convex hull only has 24 Points.
But those 156 vertices I extracted from the collision model are in a kind of indexed order in a list (multiple appearance of points in that list), the model really only got 28 points, so quite good result for the convex hull.
Post Reply