// Add the collision object to the set to deal with for a particular soft body
void btOpenCLSoftBodySolver::processCollision( btSoftBody *softBody, btCollisionObject* collisionObject )
{
int softBodyIndex = findSoftBodyIndex( softBody );
if( softBodyIndex >= 0 )
{
btCollisionShape *collisionShape = collisionObject->getCollisionShape();
float friction = collisionObject->getFriction();
int shapeType = collisionShape->getShapeType();
if( shapeType == CAPSULE_SHAPE_PROXYTYPE )
{
// Add to the list of expected collision objects
CollisionShapeDescription newCollisionShapeDescription;
newCollisionShapeDescription.softBodyIdentifier = softBodyIndex;
newCollisionShapeDescription.collisionShapeType = shapeType;
// TODO: May need to transpose this matrix either here or in HLSL
newCollisionShapeDescription.shapeTransform = toTransform3(collisionObject->getWorldTransform());
btCapsuleShape *capsule = static_cast<btCapsuleShape*>( collisionShape );
newCollisionShapeDescription.radius = capsule->getRadius();
newCollisionShapeDescription.halfHeight = capsule->getHalfHeight();
newCollisionShapeDescription.margin = capsule->getMargin();
newCollisionShapeDescription.upAxis = capsule->getUpAxis();
newCollisionShapeDescription.friction = friction;
btRigidBody* body = static_cast< btRigidBody* >( collisionObject );
newCollisionShapeDescription.linearVelocity = toVector3(body->getLinearVelocity());
newCollisionShapeDescription.angularVelocity = toVector3(body->getAngularVelocity());
m_collisionObjectDetails.push_back( newCollisionShapeDescription );
} else {
btAssert(0 && "Unsupported collision shape type\n");
}
} else {
btAssert("Unknown soft body");
}
} // btOpenCLSoftBodySolver::processCollision
Source code shows that btOpenCLSoftBodySolver::processCollision only support the shape tpye CAPSULE_SHAPE_PROXYTYPE.
I need process the shape TRIANGLE_MESH_SHAPE_PROXYTYPE. What can I do ?
Bullet is an open source project with contributions from many companies and individuals, not just Sony or AMD. You can file an issue request in the tracker here: http://code.google.com/p/bullet/issues/list
We welcome contributions from anyone.
Thanks,
Erwin
Oh.....am I to understand from this that if I use any of the OpenCL stuff for soft bodies in the 2.78 release, the only collisions I'll get are between the soft bodies and capsule shapes??
I was busy trying to implement the CL soft body solver in my simulation, thinking it was at least just used to speed up internal softbody node processing (link forces, pressure, etc) for the time being, and that collisions detection would be standard CPU computation as before (though I suppose in hindsight having the node data on a CL device *would* sort of necessitate some sort of CL collision detection processing as well...). But if collision detection will no longer work, I should stop my efforts...
A CPU fallback for cloth collision detection, when using OpenCL or DirectCompute should be easy to add. In that case you cannot leave the data on the GPU obviously. In that case the data needs to be transfered over the PCIe bus, so the benefits of CL-GL interop or DC-DX interop are lost.
In case the CPU fallback isn't implemented, please file an issue in the tracker.
Thanks,
Erwin