expose linkIndexA/B as filter option in pybullet.getContactPoints
This commit is contained in:
@@ -3817,18 +3817,20 @@ static PyObject* pybullet_getContactPointData(PyObject* self, PyObject* args, Py
|
|||||||
{
|
{
|
||||||
int bodyUniqueIdA = -1;
|
int bodyUniqueIdA = -1;
|
||||||
int bodyUniqueIdB = -1;
|
int bodyUniqueIdB = -1;
|
||||||
|
int linkIndexA = -2;
|
||||||
|
int linkIndexB = -2;
|
||||||
|
|
||||||
b3SharedMemoryCommandHandle commandHandle;
|
b3SharedMemoryCommandHandle commandHandle;
|
||||||
struct b3ContactInformation contactPointData;
|
struct b3ContactInformation contactPointData;
|
||||||
b3SharedMemoryStatusHandle statusHandle;
|
b3SharedMemoryStatusHandle statusHandle;
|
||||||
int statusType;
|
int statusType;
|
||||||
|
|
||||||
static char* kwlist[] = {"bodyA", "bodyB", "physicsClientId", NULL};
|
static char* kwlist[] = {"bodyA", "bodyB", "linkIndexA", "linkIndexB", "physicsClientId", NULL};
|
||||||
|
|
||||||
int physicsClientId = 0;
|
int physicsClientId = 0;
|
||||||
b3PhysicsClientHandle sm = 0;
|
b3PhysicsClientHandle sm = 0;
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|iii", kwlist,
|
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|iiiii", kwlist,
|
||||||
&bodyUniqueIdA, &bodyUniqueIdB, &physicsClientId))
|
&bodyUniqueIdA, &bodyUniqueIdB, &linkIndexA, &linkIndexB, &physicsClientId))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sm = getPhysicsClient(physicsClientId);
|
sm = getPhysicsClient(physicsClientId);
|
||||||
@@ -3839,10 +3841,24 @@ static PyObject* pybullet_getContactPointData(PyObject* self, PyObject* args, Py
|
|||||||
}
|
}
|
||||||
|
|
||||||
commandHandle = b3InitRequestContactPointInformation(sm);
|
commandHandle = b3InitRequestContactPointInformation(sm);
|
||||||
b3SetContactFilterBodyA(commandHandle, bodyUniqueIdA);
|
if (bodyUniqueIdA>=0)
|
||||||
b3SetContactFilterBodyB(commandHandle, bodyUniqueIdB);
|
{
|
||||||
//b3SetContactQueryMode(commandHandle, mode);
|
b3SetContactFilterBodyA(commandHandle, bodyUniqueIdA);
|
||||||
|
}
|
||||||
|
if (bodyUniqueIdB>=0)
|
||||||
|
{
|
||||||
|
b3SetContactFilterBodyB(commandHandle, bodyUniqueIdB);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linkIndexA>=-1)
|
||||||
|
{
|
||||||
|
b3SetContactFilterLinkA( commandHandle, linkIndexA);
|
||||||
|
}
|
||||||
|
if (linkIndexB >=-1)
|
||||||
|
{
|
||||||
|
b3SetContactFilterLinkB( commandHandle, linkIndexB);
|
||||||
|
}
|
||||||
|
|
||||||
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle);
|
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle);
|
||||||
statusType = b3GetStatusType(statusHandle);
|
statusType = b3GetStatusType(statusHandle);
|
||||||
if (statusType == CMD_CONTACT_POINT_INFORMATION_COMPLETED)
|
if (statusType == CMD_CONTACT_POINT_INFORMATION_COMPLETED)
|
||||||
|
|||||||
Reference in New Issue
Block a user