public override void Execute( IRaySceneQueryListener listener )
{
MovableObjectFactoryMap factories = Root.Instance.MovableObjectFactories;
foreach ( KeyValuePair<string, MovableObjectFactory> map in factories )
{
MovableObjectCollection movableObjects = this.creator.GetMovableObjectCollection( map.Value.Type );
foreach ( MovableObject movableObject in movableObjects.Values )
{
// skip group if query type doesn't match
if ( ( this.QueryTypeMask & movableObject.TypeFlags ) == 0 )
{
break;
}
// skip if unattached or filtered out by query flags
if ( !movableObject.IsAttached || ( movableObject.QueryFlags & this.queryMask ) == 0 )
{
continue;
}
// test the intersection against the world bounding box of the entity
IntersectResult results = Utility.Intersects( this.ray, movableObject.GetWorldBoundingBox() );
// if the results came back positive, fire the event handler
if ( results.Hit == true )
{
listener.OnQueryResult( movableObject, results.Distance );
}
}
}
}
}