burns
26-02-2009 22:23:18
I have a plane centered at the origin in my scene that is 65535 units by 65535 units. And I have the following code to find the object whose bounding box is under the mouse:
. . . where MouseX and MouseY range from 0 to 1
It works correctly most of the time . . . but there are sections of the plane, that it doesn't see (rayResults has a Count of 0). I checked the Ray . . . it seems to be correct at all points. I show the bounding box of the plane, and that is correct, too. But then when I get to certain parts of the plane, the rayResults count drops to 0, and it no longer thinks I'm over the plane.
One of my team members hypothesized that there may be clipping code that short circuits intersections that appear outside the camera frustum . . . but is it possible that the transform used for that clip is not updated, and its using an old camera frustum and short circuits the ray calculation even when I am inside the view of the 3D scene?
Has anyone else seen anything like this? Any ideas what the problem might be?
public void FindObjectUnderMouse( float MouseX, float MouseY )
{
Ray ray = m_Camera.GetCameraToViewportRay( MouseX, MouseY );
RaySceneQuery raySceneQuery = m_SceneMgr.CreateRayQuery( ray );
raySceneQuery.SetSortByDistance( true );
RaySceneQueryResult rayResults = raySceneQuery.Execute();
...
}
. . . where MouseX and MouseY range from 0 to 1
It works correctly most of the time . . . but there are sections of the plane, that it doesn't see (rayResults has a Count of 0). I checked the Ray . . . it seems to be correct at all points. I show the bounding box of the plane, and that is correct, too. But then when I get to certain parts of the plane, the rayResults count drops to 0, and it no longer thinks I'm over the plane.
One of my team members hypothesized that there may be clipping code that short circuits intersections that appear outside the camera frustum . . . but is it possible that the transform used for that clip is not updated, and its using an old camera frustum and short circuits the ray calculation even when I am inside the view of the 3D scene?
Has anyone else seen anything like this? Any ideas what the problem might be?