mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-08-04 12:29:21 +00:00
add reportHitNumber to allow reporting a specific ray intersection hit
(by default, pybullet.rayTestBatch reports the closest hit, so you can report 2nd closest or 3rd closest hit etc) Fix pybullet.createCollisionShape, in some cases (concave trimesh, convex mesh) two instances were created.
This commit is contained in:
@@ -3650,6 +3650,7 @@ B3_SHARED_API b3SharedMemoryCommandHandle b3CreateRaycastCommandInit(b3PhysicsCl
|
||||
command->m_requestRaycastIntersections.m_fromToRays[0].m_rayToPosition[0] = rayToWorldX;
|
||||
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;
|
||||
|
||||
return (b3SharedMemoryCommandHandle)command;
|
||||
}
|
||||
@@ -3668,6 +3669,8 @@ B3_SHARED_API b3SharedMemoryCommandHandle b3CreateRaycastBatchCommandInit(b3Phys
|
||||
command->m_requestRaycastIntersections.m_numThreads = 1;
|
||||
command->m_requestRaycastIntersections.m_parentObjectUniqueId = -1;
|
||||
command->m_requestRaycastIntersections.m_parentLinkIndex=-1;
|
||||
command->m_requestRaycastIntersections.m_reportHitNumber = -1;
|
||||
|
||||
return (b3SharedMemoryCommandHandle)command;
|
||||
}
|
||||
|
||||
@@ -3726,6 +3729,14 @@ B3_SHARED_API void b3RaycastBatchSetParentObject(b3SharedMemoryCommandHandle com
|
||||
command->m_requestRaycastIntersections.m_parentLinkIndex = parentLinkIndex;
|
||||
}
|
||||
|
||||
B3_SHARED_API void b3RaycastBatchSetReportHitNumber(b3SharedMemoryCommandHandle commandHandle, int reportHitNumber)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*)commandHandle;
|
||||
b3Assert(command);
|
||||
b3Assert(command->m_type == CMD_REQUEST_RAY_CAST_INTERSECTIONS);
|
||||
command->m_requestRaycastIntersections.m_reportHitNumber= reportHitNumber;
|
||||
}
|
||||
|
||||
|
||||
B3_SHARED_API void b3GetRaycastInformation(b3PhysicsClientHandle physClient, struct b3RaycastInformation* raycastInfo)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user