Both worldFragment & Entities from 1 Rayscenequery?

Rowan

19-02-2007 07:50:36

I'm trying to implement the Picking & Placing technique from Intermediate Tute 3, whereby a single rayscenequery is cast and if it hits an entity, that entity is picked, otherwise the worldFragment is returned.

So far, all the variations of querymasks, querytypemasks, etc.. I've tried will only return Entities xor WorldFragments (not both, as it seems with the Terrain scene manager).

Here's my code.. standard stuff (I hope) ::



// Setup the ray scene query
float screenX = arg.state.X.abs / (float) mWinWidth;
float screenY = arg.state.Y.abs / (float) mWinHeight;

Ray mouseRay = mCamera->getCameraToViewportRay( screenX, screenY );
mRaySceneQuery->setRay( mouseRay );
mRaySceneQuery->setSortByDistance( true );

mRaySceneQuery->setQueryTypeMask(SceneManager::WORLD_GEOMETRY_TYPE_MASK); // | SceneManager::ENTITY_TYPE_MASK);
mRaySceneQuery->setWorldFragmentType(SceneQuery::WFT_SINGLE_INTERSECTION);


// Execute query
RaySceneQueryResult &result = mRaySceneQuery->execute();
RaySceneQueryResult::iterator itr;


Without setQueryTypeMask() & setWorldFragmentType() calls, a list of entities is returned containing the camera and a number of tiles (too many tiles it seems). Going from the Tute, a worldFragment should also be returned for this case (w/o those calls).

If I only set the Query Type Mask to WORLD_GEOMETRY_TYPE_MASK, but leave out the setWorldFragmentType() call, nothing is returned (where it seems as though the a worldFragment should definately be returned in this case).

So obviously PLSM2 is not TSM, but I'm wondering if there is some way of returning both types with the one query..
(I should be able to use two queries to solve it I hope, but maybe there is a way someone can point out to save that extra query :wink: )

Thanks

tuan kuranes

24-02-2007 11:51:28

Seems a bug to me. Can you link this Thread in known bugs ?

Rowan

24-02-2007 13:40:47

Ok, I've just added it (hopefully I haven't missed some sort of initialization or config setting, ... I dont' think so.. I even tried a Query Listener).

I just want to say thanks for the Plugin too, it's an awesome scene manager and has made my game concept possible :D