add feature filtering for collision between spheres and meshes

This commit is contained in:
Irlan
2017-01-19 13:10:50 -02:00
parent afc08472b4
commit 20e06be722
10 changed files with 503 additions and 106 deletions

View File

@ -46,18 +46,10 @@ b3GJKOutput b3GJK(const b3Transform& xfA, const b3GJKProxy& proxyA,
// with the closest points.
struct b3GJKFeaturePair
{
enum Type
{
e_unknown = 0,
e_vertex = 1,
e_edge = 2,
e_face = 3
};
Type typeA; // number of vertices on proxy A
Type typeB; // number of vertices on proxy B
u32 indexA[3]; // vertices on proxy A
u32 countA; // number of vertices on proxy A
u32 indexB[3]; // vertices on proxy B
u32 countB; // number of vertices on proxy B
};
// Identify the vertices of the features that the closest points between two

View File

@ -58,6 +58,8 @@ private:
void Collide();
void CollideSphere();
void SynchronizeShapes();
bool MoveAABB(const b3AABB3& aabb, const b3Vec3& displacement);

View File

@ -54,13 +54,13 @@ public:
{
b3GJKFeaturePair featurePair = b3GetFeaturePair(m_cache);
for (u32 i = 0; i < (u32)featurePair.typeA; ++i)
for (u32 i = 0; i < featurePair.countA; ++i)
{
u32 index = featurePair.indexA[i];
g_debugDraw->DrawPoint(m_xfA * m_proxyA.GetVertex(index), b3Color(1.0f, 1.0f, 0.0f));
}
for (u32 i = 0; i < (u32)featurePair.typeB; ++i)
for (u32 i = 0; i < featurePair.countB; ++i)
{
u32 index = featurePair.indexB[i];
g_debugDraw->DrawPoint(m_xfB * m_proxyB.GetVertex(index), b3Color(1.0f, 1.0f, 0.0f));
@ -133,4 +133,4 @@ public:
b3SimplexCache m_cache;
};
#endif
#endif