Problem in raySceneQuery

58 views
Skip to first unread message

whatazor

unread,
Jul 22, 2007, 2:05:33 AM7/22/07
to Python Ogre Developers
Hi All,
I make a demo in python, in which, when I click over thge render
window
I select a object. I use the Xadeck tutorial, but when I catch the
left button down event and try to execute the query:

mouseRay =
self.ogreRoot.sceneEntities.Camera.getCameraToViewportRay( self.mouseX,
self.mouseY )
raySceneQuery = self.ogreRoot.sceneManager.createRayQuery(ogre.Ray())
raySceneQuery.setRay(mouseRay)
raySceneQuery.setSortByDistance(True)
result = raySceneQuery.execute()

I've this error:

result = raySceneQuery.execute()
Boost.Python.ArgumentError: Python argument types in
DefaultRaySceneQuery.execute(DefaultRaySceneQuery)
did not match C++ signature:
execute(struct DefaultRaySceneQuery_wrapper {lvalue}, class
Ogre::RaySceneQueryListener * listener)
execute(class Ogre::DefaultRaySceneQuery {lvalue}, class
Ogre::RaySceneQueryListener * listener)

I've seen the api but I don't understand where is the problem.
I use python 2.4.3.
Any advice?

thankyou very much
w

Andy Miller

unread,
Jul 22, 2007, 3:00:59 AM7/22/07
to python-ogre...@googlegroups.com
Did you look at Demo_Terrain as it has a Rayquery example as does one of the OgreNewt demos (Demo04_Raycasting)
 
Cheers
Andy

 

Krešimir Špes

unread,
Jul 22, 2007, 4:26:23 AM7/22/07
to Python Ogre Developers
I made a simple RaySceneListener class and handled my picking that
way. also got the C++ error there.

Andy Miller

unread,
Jul 22, 2007, 5:08:11 AM7/22/07
to python-ogre...@googlegroups.com
Can you confirm that Demo_Terrain works... 
 
And if so can you post a complete example of the problem app -- I've tested your code snippets and they work OK for me..
 
Cheers

Andy

 
On 22/07/07, whatazor <dan...@gmail.com> wrote:

whatazor

unread,
Jul 22, 2007, 10:44:29 AM7/22/07
to Python Ogre Developers
Demo_Terrain works, in fact there are no substancial difference when I
execute the query.
When I try to use it on my demo, where I use wxOgreWindow, and don't
import SampleFramework, it fails
as above.

Andy Miller

unread,
Jul 22, 2007, 11:22:22 PM7/22/07
to python-ogre...@googlegroups.com
Can you send through you complete demo code...

Krešimir Špes

unread,
Sep 4, 2007, 6:55:43 PM9/4/07
to Python Ogre Developers
the same problem occours in 1.0 though terrain demo seems to work ok.
In terrain demo, createRayQuery returns 'RaySceneQuery' object whilst
in my code I get 'DefaultRaySceneQuery'

dermont

unread,
Oct 20, 2007, 4:46:21 AM10/20/07
to Python Ogre Developers
Hi, I seem to be having similar problems with this , e.g. when
creating a PlaneBoundedVolumeListSceneQuery, much the same as:
http://www.ogre3d.org/wiki/index.php/Intermediate_Tutorial_4

Whenever I try:
mVolQuery =
mSceneMgr.createPlaneBoundedVolumeQuery(PlaneBoundedVolumeList())
mVolQuery.execute()

Error
=====


Boost.Python.ArgumentError: Python argument types in

PlaneBoundedVolumeListSceneQuery.execute(PlaneBoundedVolumeListSceneQuery)


did not match C++ signature:

execute(PlaneBoundedVolumeListSceneQuery_wrapper {lvalue},
Ogre::SceneQueryListener*)
execute(Ogre::PlaneBoundedVolumeListSceneQuery {lvalue},
Ogre::SceneQueryListener* listener)

Pretty much the same happens for other SceneQueries (except
raySceneQuery), basically forcing me to subclass SceneQueryListener
and mVolQuery.execute(MyListener).

Is this a known issue or more likely some code error that should I
debug further.

Andy Miller

unread,
Oct 20, 2007, 5:18:24 AM10/20/07
to python-ogre...@googlegroups.com
I will have to take a look -- it's not something I'm specifically aware of..
 
Andy

 

magenda...@gmail.com

unread,
Oct 20, 2007, 1:51:48 PM10/20/07
to Python Ogre Developers
Hi!

According to the ogre reference http://www.ogre3d.org/docs/api/html/classOgre_1_1RaySceneQuery.html,
there are two versions of the execute() method:


virtual RaySceneQueryResult & execute (void)
Executes the query, returning the results back in one list.

virtual void execute (RaySceneQueryListener *listener)=0
Executes the query and returns each match through a listener
interface.

Apparently, only one works in python-ogre, if you don't import
SampleFramework. So basically you need to use something like this:


class MyRaySceneQueryListener ( ogre.RaySceneQueryListener ):

def __init__( self ):

super ( MyRaySceneQueryListener, self ).__init__()


def getCoords( self, ms ):


pos_w = float( ms.X.abs ) / app.window.Width
pos_h = float( ms.Y.abs ) / app.window.Height

self.mouseRay = app.camera.getCameraToViewportRay ( pos_w,
pos_h )
self.raySceneQuery = app.sceneManager.createRayQuery
( ogre.Ray() )
self.raySceneQuery.setRay ( self.mouseRay )
self.raySceneQuery.setSortByDistance ( True )

self.raySceneQuery.execute ( self )

def queryResult ( self, entity, distance ):

print entity.getName(), self.mouseRay.getPoint ( distance )


...and then call getCoords from an instance of the class.

:)

On Oct 20, 12:18 pm, "Andy Miller" <nzmill...@gmail.com> wrote:
> I will have to take a look -- it's not something I'm specifically aware of..
>
> Andy
>

Reply all
Reply to author
Forward
0 new messages