|
@@ -94,3 +94,59 @@ btCollisionAlgorithmCreateFunc *GodotCollisionConfiguration::getClosestPointsAlg
|
|
|
return btDefaultCollisionConfiguration::getClosestPointsAlgorithmCreateFunc(proxyType0, proxyType1);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+GodotSoftCollisionConfiguration::GodotSoftCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) :
|
|
|
+ btSoftBodyRigidBodyCollisionConfiguration(constructionInfo) {
|
|
|
+
|
|
|
+ void *mem = NULL;
|
|
|
+
|
|
|
+ mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::CreateFunc), 16);
|
|
|
+ m_rayWorldCF = new (mem) GodotRayWorldAlgorithm::CreateFunc(world);
|
|
|
+
|
|
|
+ mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::SwappedCreateFunc), 16);
|
|
|
+ m_swappedRayWorldCF = new (mem) GodotRayWorldAlgorithm::SwappedCreateFunc(world);
|
|
|
+}
|
|
|
+
|
|
|
+GodotSoftCollisionConfiguration::~GodotSoftCollisionConfiguration() {
|
|
|
+ m_rayWorldCF->~btCollisionAlgorithmCreateFunc();
|
|
|
+ btAlignedFree(m_rayWorldCF);
|
|
|
+
|
|
|
+ m_swappedRayWorldCF->~btCollisionAlgorithmCreateFunc();
|
|
|
+ btAlignedFree(m_swappedRayWorldCF);
|
|
|
+}
|
|
|
+
|
|
|
+btCollisionAlgorithmCreateFunc *GodotSoftCollisionConfiguration::getCollisionAlgorithmCreateFunc(int proxyType0, int proxyType1) {
|
|
|
+
|
|
|
+ if (CUSTOM_CONVEX_SHAPE_TYPE == proxyType0 && CUSTOM_CONVEX_SHAPE_TYPE == proxyType1) {
|
|
|
+
|
|
|
+ // This collision is not supported
|
|
|
+ return m_emptyCreateFunc;
|
|
|
+ } else if (CUSTOM_CONVEX_SHAPE_TYPE == proxyType0) {
|
|
|
+
|
|
|
+ return m_rayWorldCF;
|
|
|
+ } else if (CUSTOM_CONVEX_SHAPE_TYPE == proxyType1) {
|
|
|
+
|
|
|
+ return m_swappedRayWorldCF;
|
|
|
+ } else {
|
|
|
+
|
|
|
+ return btSoftBodyRigidBodyCollisionConfiguration::getCollisionAlgorithmCreateFunc(proxyType0, proxyType1);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+btCollisionAlgorithmCreateFunc *GodotSoftCollisionConfiguration::getClosestPointsAlgorithmCreateFunc(int proxyType0, int proxyType1) {
|
|
|
+
|
|
|
+ if (CUSTOM_CONVEX_SHAPE_TYPE == proxyType0 && CUSTOM_CONVEX_SHAPE_TYPE == proxyType1) {
|
|
|
+
|
|
|
+ // This collision is not supported
|
|
|
+ return m_emptyCreateFunc;
|
|
|
+ } else if (CUSTOM_CONVEX_SHAPE_TYPE == proxyType0) {
|
|
|
+
|
|
|
+ return m_rayWorldCF;
|
|
|
+ } else if (CUSTOM_CONVEX_SHAPE_TYPE == proxyType1) {
|
|
|
+
|
|
|
+ return m_swappedRayWorldCF;
|
|
|
+ } else {
|
|
|
+
|
|
|
+ return btSoftBodyRigidBodyCollisionConfiguration::getClosestPointsAlgorithmCreateFunc(proxyType0, proxyType1);
|
|
|
+ }
|
|
|
+}
|