public override void Execute( IRaySceneQueryListener listener )
{
List<PCZSceneNode> list = new List<PCZSceneNode>();
//find the nodes that intersect the AAB
( (PCZSceneManager)creator ).FindNodesIn( ray, ref list, startZone, (PCZSceneNode)excludeNode );
//grab all moveables from the node that intersect...
foreach ( PCZSceneNode node in list )
{
foreach ( MovableObject m in node.Objects )
{
if ( ( m.QueryFlags & queryMask ) != 0 &&
( m.TypeFlags & queryTypeMask ) != 0 &&
m.IsAttached )
{
IntersectResult result = ray.Intersects( m.GetWorldBoundingBox() );
if ( result.Hit )
{
listener.OnQueryResult( m, result.Distance );
// deal with attached objects, since they are not directly attached to nodes
if ( m.MovableType == "Entity" )
{
//Check: not sure here...
Entity e = (Entity)m;
foreach ( MovableObject c in e.SubEntities )
{
if ( ( c.QueryFlags & queryMask ) > 0 )
{
result = ray.Intersects( c.GetWorldBoundingBox() );
if ( result.Hit )
{
listener.OnQueryResult( c, result.Distance );
}
}
}
}
}
}
}
}
// reset startzone and exclude node
startZone = null;
excludeNode = null;
}