1) I use "Shape[3]=new TriangleMeshShape(Array);" Is there a difference between this and "Shape[3]=new BvhTriangleMeshShape(Array);" ? They're both derived from ConcaveShape, and what if my triangled object is Convex ?
2) TriangleMeshes cannot move as I see, is there any convex mesh that can be moved ?
3) Is there a triangle shape that I can add ? So I can make compounds of more triangles to simulate my object ?
4) As a side question : Does Ageia's PhysX or Havok currently support TriangleMeshe<->TriangleMeshes dynamics ?
TriangleMeshes
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: TriangleMeshes
BvhTriangleMeshShape uses a optimization, a Bounding Volume Hierarchy (a AABB tree, with stackless traversal). The TriangleMeshShape is brute-force slow, but can be useful for very small meshes (< 5 triangles).cippyboy wrote:1) I use "Shape[3]=new TriangleMeshShape(Array);" Is there a difference between this and "Shape[3]=new BvhTriangleMeshShape(Array);" ? They're both derived from ConcaveShape, and what if my triangled object is Convex ?
For convex meshes, use either ConvexTriangleMeshShape or ConvexHullShape. The latter just takes a point cloud (Bullet's Gjk doesn't requires/benefit from connectivity, no 'hill-climbing').
ConvexTriangleMeshShape or ConvexHullShape can be moved. So can be compound shapes. For compounds, make sure the inertia has some useable values. Typically the bounding-box can be used as approximation for inertia tensor.2) TriangleMeshes cannot move as I see, is there any convex mesh that can be moved ?
Yes, you can add triangle shapes to compounds, but watch the inertia tensor. In the future a better inertia tensor computation will be added for compounds. Also, at the moment compounds don't have an additional midphase BVH/tree optimization, so keep the number of parts small (<10).3) Is there a triangle shape that I can add ? So I can make compounds of more triangles to simulate my object ?
No they don't. Ageia has a PMAP for that purpose, but that is deprecated for real-time purposes.4) As a side question : Does Ageia's PhysX or Havok currently support TriangleMeshe<->TriangleMeshes dynamics ?
-
- Posts: 36
- Joined: Fri Aug 25, 2006 1:00 am
- Location: Bucharest
Ok, so I kinda understand now and figured that an usual 3d object is not exactly convex, not even a rock is convex... Is there an easy way to test if an object is convex ? or one already in 3DS Max as that is what I use for exporting.
I just marked a concave object as convex, what exactly happens in that situation ? because I see that it kinda emulates some boxes around my object, which would be good in same cases, although their not accurate.
I just marked a concave object as convex, what exactly happens in that situation ? because I see that it kinda emulates some boxes around my object, which would be good in same cases, although their not accurate.
-
- Posts: 127
- Joined: Sun Aug 13, 2006 4:41 pm
- Location: Cedar Hill, Texas
Some rocks are convex.cippyboy wrote:Ok, so I kinda understand now and figured that an usual 3d object is not exactly convex, not even a rock is convex...
You'd have to calculate the angles between each pair of polygons that share a common edge and only if every edge is convex is the entire mesh convex. However, that only works for closed meshes (ie no holes or disconnected parts). The definition of "concave" and "convex" is really undefined for meshes with holes.Is there an easy way to test if an object is convex ? or one already in 3DS Max as that is what I use for exporting.
I'm not 100% sure - but in all likelyhood it would act as if the concave parts of it were 'filled in'. Imagine if you had a polygonal model of the letter 'E' - (which has two concavities) it would behave as if it were a solid rectangle...but like I said - I'm not 100% sure.I just marked a concave object as convex, what exactly happens in that situation ? because I see that it kinda emulates some boxes around my object, which would be good in same cases, although their not accurate.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Thanks Steve, you are right:SteveBaker wrote:I'm not 100% sure - but in all likelyhood it would act as if the concave parts of it were 'filled in'. Imagine if you had a polygonal model of the letter 'E' - (which has two concavities) it would behave as if it were a solid rectangle...but like I said - I'm not 100% sure.I just marked a concave object as convex, what exactly happens in that situation ? because I see that it kinda emulates some boxes around my object, which would be good in same cases, although their not accurate.
it will fill-in the concave parts.
Also notice that it is recommended to use the ConvexHullShape, and just pass points/vertices. For best performance it's best to keep the number of vertices low (using a low-level of detail or mesh simplification/reduction).
-
- Posts: 36
- Joined: Fri Aug 25, 2006 1:00 am
- Location: Bucharest
-
- Posts: 127
- Joined: Sun Aug 13, 2006 4:41 pm
- Location: Cedar Hill, Texas
It makes collision detection math harder because there are more special cases. A convex object hitting a flat surface can only hit it at one point - but an object with concavities can hit it in several places.cippyboy wrote:Ok, thanks a bunch, can I ask why is it so hard for cancave meshes to exist ? Or is it just impossible ? :D
It's not impossible - just much harder and hence slower.
-
- Posts: 36
- Joined: Fri Aug 25, 2006 1:00 am
- Location: Bucharest
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
performance is one reasons. the other is robustness.
You can already use moving concave compounds in Bullet. But that works most reliable when you add convex pieces with volume. That way there is likely some valid collision normals available. Single triangles can easily get into degeneracies, and it even becomes worse then multiple concave meshes collide. Once continuous collision detection and response without any penetration is fully reliable, it should be easier to allow concave general meshes. But that's one of the areas we are working on.
Erwin
You can already use moving concave compounds in Bullet. But that works most reliable when you add convex pieces with volume. That way there is likely some valid collision normals available. Single triangles can easily get into degeneracies, and it even becomes worse then multiple concave meshes collide. Once continuous collision detection and response without any penetration is fully reliable, it should be easier to allow concave general meshes. But that's one of the areas we are working on.
Erwin