mirror of
https://github.com/bulletphysics/bullet3
synced 2025-01-18 21:10:05 +00:00
Merge pull request #2967 from erwincoumans/master
fix raycast filter masks, they can be negative
This commit is contained in:
commit
b623f5d123
@ -5995,12 +5995,9 @@ struct FilteredClosestRayResultCallback : public btCollisionWorld::ClosestRayRes
|
||||
|
||||
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace)
|
||||
{
|
||||
if (m_collisionFilterMask >= 0)
|
||||
{
|
||||
bool collides = (rayResult.m_collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & m_collisionFilterMask) != 0;
|
||||
if (!collides)
|
||||
return m_closestHitFraction;
|
||||
}
|
||||
bool collides = (rayResult.m_collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & m_collisionFilterMask) != 0;
|
||||
if (!collides)
|
||||
return m_closestHitFraction;
|
||||
return btCollisionWorld::ClosestRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
|
||||
}
|
||||
};
|
||||
@ -6019,12 +6016,9 @@ struct FilteredAllHitsRayResultCallback : public btCollisionWorld::AllHitsRayRes
|
||||
|
||||
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace)
|
||||
{
|
||||
if (m_collisionFilterMask >= 0)
|
||||
{
|
||||
bool collides = (rayResult.m_collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & m_collisionFilterMask) != 0;
|
||||
if (!collides)
|
||||
return m_closestHitFraction;
|
||||
}
|
||||
bool collides = (rayResult.m_collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & m_collisionFilterMask) != 0;
|
||||
if (!collides)
|
||||
return m_closestHitFraction;
|
||||
//remove duplicate hits:
|
||||
//same collision object, link index and hit fraction
|
||||
bool isDuplicate = false;
|
||||
|
@ -19,7 +19,7 @@ import datetime
|
||||
import os
|
||||
import time
|
||||
|
||||
import tf.compat.v1 as tf
|
||||
import tensorflow.compat.v1 as tf
|
||||
from pybullet_envs.minitaur.envs import minitaur_logging_pb2
|
||||
|
||||
NUM_MOTORS = 8
|
||||
|
@ -6576,10 +6576,8 @@ static PyObject* pybullet_rayTestObsolete(PyObject* self, PyObject* args, PyObje
|
||||
to[0], to[1], to[2]);
|
||||
|
||||
|
||||
if (collisionFilterMask >= 0)
|
||||
{
|
||||
b3RaycastBatchSetCollisionFilterMask(commandHandle, collisionFilterMask);
|
||||
}
|
||||
b3RaycastBatchSetCollisionFilterMask(commandHandle, collisionFilterMask);
|
||||
|
||||
if (reportHitNumber >= 0)
|
||||
{
|
||||
b3RaycastBatchSetReportHitNumber(commandHandle, reportHitNumber);
|
||||
@ -6751,10 +6749,8 @@ static PyObject* pybullet_rayTestBatch(PyObject* self, PyObject* args, PyObject*
|
||||
{
|
||||
b3RaycastBatchSetReportHitNumber(commandHandle, reportHitNumber);
|
||||
}
|
||||
if (collisionFilterMask >= 0)
|
||||
{
|
||||
b3RaycastBatchSetCollisionFilterMask(commandHandle, collisionFilterMask);
|
||||
}
|
||||
b3RaycastBatchSetCollisionFilterMask(commandHandle, collisionFilterMask);
|
||||
|
||||
if (fractionEpsilon >= 0)
|
||||
{
|
||||
b3RaycastBatchSetFractionEpsilon(commandHandle, fractionEpsilon);
|
||||
|
Loading…
Reference in New Issue
Block a user