CaseyB
22-11-2006 05:33:49
I am trying to mouse pick using the code from the Wiki and it keeps returning world fragments as renderables. Here's how I'm going the query:
if (e->getButtonID() & MouseEvent::BUTTON0_MASK) // Left mouse Button
{
// Setup the ray scene query
Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
mRaySceneQuery->setRay( mouseRay );
mRaySceneQuery->setSortByDistance( true );
// Execute query
RaySceneQueryResult &result = mRaySceneQuery->execute();
RaySceneQueryResult::iterator itr;
// loop through the results
for ( itr = result.begin( ); itr != result.end(); itr++ )
{
if (itr->worldFragment) // Is this result a WorldFragment?
{
Vector3 location = itr->worldFragment->singleIntersection;
cout << "World Fragment " + Ogre::StringConverter::toString(location);
}
else if (itr->movable) // Is this result a MovableObject?
{
cout << "I'm a Mesh!";
}
}
}
And I was suprised to see that my world fragment code was never being called and when I step through I see that I picked an object that came back as a movable that was called "1.1.2.3Rend" and I am guessing that's terrain. I am using Dagon and the PLSM2 from CVS.