Add a convenience method to control the number of single-shot contact points for convex-convex collision detection, using the perturbation method.
(btDefaultCollisionConfiguration::setConvexConvexMultipointIterations) Default value is zero, for best performance.
This commit is contained in:
@@ -288,3 +288,10 @@ btCollisionAlgorithmCreateFunc* btDefaultCollisionConfiguration::getCollisionAlg
|
|||||||
//failed to find an algorithm
|
//failed to find an algorithm
|
||||||
return m_emptyCreateFunc;
|
return m_emptyCreateFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void btDefaultCollisionConfiguration::setConvexConvexMultipointIterations(int numPerturbationIterations, int minimumPointsPerturbationThreshold)
|
||||||
|
{
|
||||||
|
btConvexConvexAlgorithm::CreateFunc* convexConvex = (btConvexConvexAlgorithm::CreateFunc*) m_convexConvexCreateFunc;
|
||||||
|
convexConvex->m_numPerturbationIterations = numPerturbationIterations;
|
||||||
|
convexConvex->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
|
||||||
|
}
|
||||||
|
|||||||
@@ -111,6 +111,14 @@ public:
|
|||||||
|
|
||||||
virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1);
|
virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1);
|
||||||
|
|
||||||
|
///Use this method to allow to generate multiple contact points between at once, between two objects using the generic convex-convex algorithm.
|
||||||
|
///By default, this feature is disabled for best performance.
|
||||||
|
///@param numPerturbationIterations controls the number of collision queries. Set it to zero to disable the feature.
|
||||||
|
///@param minimumPointsPerturbationThreshold is the minimum number of points in the contact cache, above which the feature is disabled
|
||||||
|
///3 is a good value for both params, if you want to enable the feature. This is because the default contact cache contains a maximum of 4 points, and one collision query at the unperturbed orientation is performed first.
|
||||||
|
///See Bullet/Demos/CollisionDemo for an example how this feature gathers multiple points.
|
||||||
|
///@todo we could add a per-object setting of those parameters, for level-of-detail collision detection.
|
||||||
|
void setConvexConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold = 3);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user