alex_dergian
06-11-2006 22:25:10
Im not sure why but when i do a mouse ray on the terrain it sends back a posstion that is very off i hcecked the objects and it is not them it is the ray, it dose set the y correcly but the x and z are way off here is the code i use for the deleration and creating of the ray Query system
So it casts only on terrain type worlds and i belive the other stuff i got from another post i wanted to test as much as a could before posting a question.
Anyways then i call the ray like so
I would tell you how far off the system is but i never know where my mouse is and the placment is more random then consistant, i guess with the resualts i could feed the random seed generater for some intresting resulats but i would rather have a working ray system.
Thanks in advance!
mRaySceneQuery = mScene->createRayQuery( Ogre::Ray() );
Ogre::String scene = Aero::staticFunction::getOption("currentScene", mOptionAddress );
if( scene == Ogre::String("terrain") || scene == Ogre::String("inside"))
{
mRaySceneQuery->setQueryTypeMask(Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK );
mRaySceneQuery->setWorldFragmentType(Ogre::SceneQuery::WFT_SINGLE_INTERSECTION);
}
So it casts only on terrain type worlds and i belive the other stuff i got from another post i wanted to test as much as a could before posting a question.
Anyways then i call the ray like so
if( mCState->mSceneReady == true )
{
Ogre::Ray mouseRay = mAeroCamera->ray( e->getRelX(), e->getRelY() );
mCState->editObjectMap()->getObjectRay()->setRay( mouseRay );
// Execute query
Ogre::RaySceneQueryResult &result = mCState->editObjectMap()->getObjectRay()->execute();
Ogre::RaySceneQueryResult::iterator itr = result.begin( );
// Get results, move the player to the possition
if ( itr != result.end() && itr->worldFragment )
{
//Create test at point
//mPlayer->setMovePoint(itr->worldFragment->singleIntersection);
mCState->editObjectMap()->addObject("folaige_tree_treetest", itr->worldFragment->singleIntersection);
}
}
I would tell you how far off the system is but i never know where my mouse is and the placment is more random then consistant, i guess with the resualts i could feed the random seed generater for some intresting resulats but i would rather have a working ray system.
Thanks in advance!