mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-08-05 21:09:19 +00:00
add collisionFilterMask to rayTestBatch and rayTest
This will allow to exclude (filter) certain bodies. By default, static bodies have collision group 2, and dynamic (mass=1) bodies have collision group 1. As long as mask & group != 0, a raytest will be performed.
This commit is contained in:
@@ -3651,6 +3651,8 @@ B3_SHARED_API b3SharedMemoryCommandHandle b3CreateRaycastCommandInit(b3PhysicsCl
|
||||
command->m_requestRaycastIntersections.m_fromToRays[0].m_rayToPosition[1] = rayToWorldY;
|
||||
command->m_requestRaycastIntersections.m_fromToRays[0].m_rayToPosition[2] = rayToWorldZ;
|
||||
command->m_requestRaycastIntersections.m_reportHitNumber = -1;
|
||||
command->m_requestRaycastIntersections.m_collisionFilterMask = -1;
|
||||
|
||||
|
||||
return (b3SharedMemoryCommandHandle)command;
|
||||
}
|
||||
@@ -3670,6 +3672,7 @@ B3_SHARED_API b3SharedMemoryCommandHandle b3CreateRaycastBatchCommandInit(b3Phys
|
||||
command->m_requestRaycastIntersections.m_parentObjectUniqueId = -1;
|
||||
command->m_requestRaycastIntersections.m_parentLinkIndex=-1;
|
||||
command->m_requestRaycastIntersections.m_reportHitNumber = -1;
|
||||
command->m_requestRaycastIntersections.m_collisionFilterMask = -1;
|
||||
|
||||
return (b3SharedMemoryCommandHandle)command;
|
||||
}
|
||||
@@ -3736,7 +3739,13 @@ B3_SHARED_API void b3RaycastBatchSetReportHitNumber(b3SharedMemoryCommandHandle
|
||||
b3Assert(command->m_type == CMD_REQUEST_RAY_CAST_INTERSECTIONS);
|
||||
command->m_requestRaycastIntersections.m_reportHitNumber= reportHitNumber;
|
||||
}
|
||||
|
||||
B3_SHARED_API void b3RaycastBatchSetCollisionFilterMask(b3SharedMemoryCommandHandle commandHandle, int collisionFilterMask)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*)commandHandle;
|
||||
b3Assert(command);
|
||||
b3Assert(command->m_type == CMD_REQUEST_RAY_CAST_INTERSECTIONS);
|
||||
command->m_requestRaycastIntersections.m_collisionFilterMask = collisionFilterMask;
|
||||
}
|
||||
|
||||
B3_SHARED_API void b3GetRaycastInformation(b3PhysicsClientHandle physClient, struct b3RaycastInformation* raycastInfo)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user