Problem with SceneQueries

scriptkid

19-10-2006 22:41:17

Hi there,

bit of a long post, but my problem should be clear more now ;-)

I'm trying to the use Ogre's SceneQuery functionality via PyOgre, however i have run into a few problems.

To use the IntersectionSceneQuery i follow these steps:
self.query = self.sceneManager.createIntersectionQuery()
Works fine; it creates an instance of IntersectionSceneQuery.

Now i tried to get the results through:
results = self.query.execute()
in order to query the 'movables2movables' member. However with no luck, since the 'SceneQueryMovableObjectPair' type seems not to be mapped to PyOgre. Am i right?

So i tried the overload of the 'execute' method, which accepts a 'IntersectionSceneQueryListener'. However now i am stuck, because i get a 'No matching function for overloaded 'IntersectionSceneQuery_execute' error. This is my listener class:

class MyListener(ogre.IntersectionSceneQueryListener):
def __init__(self):
print "Constructing listener"

def __repr__(self):
return "MyListener"

def queryResult(self, first, second):
print ("Collision between %s and %s" % (first, second))
return True


I call the execute method like this:
self.query.execute(MyListener())

Calling it with the query object itself works fine (because it also inherits from the IntersectionSceneQueryListener):
self.query.execute(self.query)
Pretty useless, but just a test.

To make sure that i pass a correct object, i printed out both class trees:
Tree of <pyogre.ogre.IntersectionSceneQuery; proxy of C++ Ogre::IntersectionSceneQuery instance at _18a22c03_p_Ogre__IntersectionSceneQuery>
... IntersectionSceneQuery
...... SceneQuery
......... object
...... IntersectionSceneQueryListener
......... object
Tree of MyListener
... MyListener
...... IntersectionSceneQueryListener
......... object

As you can see, both derive from IntersectionSceneQueryListener.

Tracing the file doesnt allow me to look very far, because of the call to _ogre.pyd. It does call the 'IntersectionSceneQuery's execute(*args) method.

Does anybody have a clue about what's going on? Thanks a lot and thanks for creating PyOgre!

dermont

20-10-2006 09:00:59

The IntersectionQuery and SceneQueryListeners are on the TODO list:
http://svn.berlios.de/wsvn/pyogre/branc ... rev=0&sc=0

scriptkid

20-10-2006 09:56:13

Thanks for the answer. Okay i'll do some other stuff first then :-)

That will be an overhaul to 1.2 right?

bharling

20-10-2006 11:28:19

You could use my (rather basic) octree collision script as a temporary replacement for the IntersectionQuery. its here ..http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2206&sid=e5fc8d20e588027110ccc8bfeb8540ac

Its not as good as a proper scene query, but it does seem to work quite well.

That reminds me, I will update the version on the wiki as it is currently a bit nackered.