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
Entity from triangleMesh
Re: Entity from triangleMesh
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.
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.
Re: Entity from triangleMesh
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.
Re: Entity from triangleMesh
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.
Re: Entity from triangleMesh
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.
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.