Picking Scene Nodes By Region

The following methods allow you to pick one or more objects based on their position in the viewports. All coordinates used in these methods are in Windows format with the origin in the upper left. The gw.getWinSizeX() and gw.getWinSizeY() methods can be used to determine the size of the viewport in pixels. The objects to pick are filtered based on the Selection Filter specified in the 3ds Max main toolbar.

   

boxPickNode <box2> [		crossing:<boolean>] 	 

Returns an array of the nodes within the specified rectangular region. The <box2> value specifies the corner in pixel values within the active viewport. If the crossing: parameter value is true , an object only partially in the region will be picked. If false , the object must be completely within the region to be picked. The default crossing: value is true .

FOR EXAMPLE,

boxPickNode (box2 [0,0] [1000,1000])

   

circlePickNode <box2> [	 crossing:<boolean>]   

Returns an array of the nodes within the specified circular region. The <box2> value specifies the center of the circle and a point on the circle in pixel values within the active viewport. If the crossing: parameter value is true , an object only partially in the region will be picked. If false , the object must be completely within the region to be picked. The default crossing: value is true . The [left, bottom] and [right, top] components of the box2 parameter value correspond to the center and radius points, respectively. The box2 parameter value needs to be set up in a specific manner as shown in the following script:

FOR EXAMPLE,

vpCenter = (point2 (gw.getWinSizeX()) (gw.getWinSizeY()))/2
vpQuarter = point2 (vpCenter.x/2) vpCenter.y
circleRegion = box2 0 0 0 0 -- initialize circleRegion to a box2 value
circleRegion.left = vpCenter.x -- the center of the circle
circleRegion.bottom = vpCenter.y
circleRegion.right = vpCenter.x/2 -- a point on the circle
circleRegion.top = vpCenter.y
for obj in (circlePickNode circleRegion crossing:false) do
print obj.name

This will print the names of all nodes completely within a circular region, where the center of the circle is the center of the viewport and the point on the circle is located one quarter of the distance from the edge to the center of the viewport.

   

fencePickNode <point2_array> [  crossing:<boolean>] 

Returns an array of the nodes within the specified fenced region. The fenced area is defined by the array of point2 values. The default crossing: value is true .

See Also