Using masks with RaySceneQuery?

futnuh

13-04-2007 08:33:33

In the snippet that follows, I'm expecting only to see 'hits' on entity3. Instead the listener is getting called if any of the three entities are beneath the origin. What am I doing wrong? (This is the latest python-ogre.)


def foobar(self):
[...]
self.entity1.setQueryFlags(1)
self.entity2.setQueryFlags(1)
self.entity3.setQueryFlags(2)
[...]
ray = ogre.Ray(origin, ogre.Vector3.NEGATIVE_UNIT_Y)
rayquery = self.scenemanager.createRayQuery(ray)
rayquery.setQueryMask(2)
listener = RaySceneQueryListener()
rayquery.execute(listener)

class RaySceneQueryListener(ogre.RaySceneQueryListener):
def queryResult(self, obj, distance):
print obj, distance, obj.getName()