Rectangular Selection with PlaneBoundedVolumeListSceneQuery

sirleon

02-12-2009 21:43:20

hello,

i'm working with mogre and i have a problem.

i'm trying to use PlaneBoundedVolumeListSceneQuery as seen in tutorial 4 for make a Rectangular Selection

with this code

Camera cam = GetCamera(); //is not null

Ray topLeft = cam.GetCameraToViewportRay(left, top);
Ray topRight = cam.GetCameraToViewportRay(right, top);
Ray bottomLeft = cam.GetCameraToViewportRay(left, bottom);
Ray bottomRight = cam.GetCameraToViewportRay(right, bottom);

PlaneBoundedVolume vol = new PlaneBoundedVolume();
vol.planes.Add(new Plane(topLeft.GetPoint(3), topRight.GetPoint(3), bottomRight.GetPoint(3))); // front plane
vol.planes.Add(new Plane(topLeft.Origin, topLeft.GetPoint(100), topRight.GetPoint(100))); // top plane
vol.planes.Add(new Plane(topLeft.Origin, bottomLeft.GetPoint(100), topLeft.GetPoint(100))); // left plane
vol.planes.Add(new Plane(bottomLeft.Origin, bottomRight.GetPoint(100), bottomLeft.GetPoint(100))); // bottom plane
vol.planes.Add(new Plane(topRight.Origin, topRight.GetPoint(100), bottomRight.GetPoint(100))); // right plane

PlaneBoundedVolumeList volList = new PlaneBoundedVolumeList();
volList.Add(vol);

_selectionRectangleSceneQuery.SetVolumes(volList);
SceneQueryResult result = _selectionRectangleSceneQuery.Execute();

if (result.movables == null) return;

foreach (MovableObject res in result.movables)
{
//HERE DON'T FIND THE ROBOTS THAT RAY QUERY FIND
}


i don't understand why ray query catch the robot and volume query don't

this is a shot of the selected rectangle

[attachment=0]screenshot1.jpg[/attachment]