som
29-07-2008 13:06:29
hi guys...
m using this code to achieve mouse picking..
when i'm clicking on any object in the scene, raySceneQueryResult shows a system.exception for the Back & Front properties of it.
This results in no picking as result.count = 0..
guys can any one give me a solution..
Thanx as alwayz...
try
{
//mRaySceneQuery = sceneMgr.CreateRayQuery(new Ray());
// Setup the ray scene query
Ray mouseRay = sceneManager.CameraManager.GetCamera.GetCameraToViewportRay(XAbs / (float)sceneManager.CameraManager.GetViewport.ActualWidth,
YAbs / (float)sceneManager.CameraManager.GetViewport.ActualHeight);
//mRaySceneQuery.Ray = mouseRay;
RaySceneQuery mRaySceneQuery = sceneMgr.CreateRayQuery(mouseRay);
mRaySceneQuery.SetSortByDistance(true);
// Execute query
mRaySceneQuery.Execute();
RaySceneQueryResult result = mRaySceneQuery.GetLastResults();
for (int i = 0; i < result.Count; i++)
{
if ((result[i].movable != null) && (result[i].movable.MovableType.CompareTo("Entity") == 0)
&& (result[i].movable.QueryFlags == (uint)QueryMask.ENTITY_MASK))
{
if (mEntity != (Entity)result[i].movable)
{
mCurrentObject = result[i].movable.ParentSceneNode;
mEntity = (Entity)result[i].movable;
break;
}
}
}
}
catch (System.Exception e)
{
MessageBox.Show(e.Message);
}
m using this code to achieve mouse picking..
when i'm clicking on any object in the scene, raySceneQueryResult shows a system.exception for the Back & Front properties of it.
This results in no picking as result.count = 0..
guys can any one give me a solution..
Thanx as alwayz...