3D Lingo Dictionary > L-N > modelsUnderLoc |
![]() ![]() ![]() |
modelsUnderLoc
Syntax
member(whichCastmember
).camera(whichCamera
).modelsUnderLoc(pointWithinSprite
{,maxNumberOfModels, levelOfDetail
})
Description
3D command; returns a list of models found under the point specified by pointWithinSprite
within the rect of a sprite using the referenced camera. The location pointWithinSprite
is relative to the upper left corner of the sprite, in pixels.
The optional maxNumberOfModels
parameter allows you to limit the length of the returned list. If this parameter isn't specified, the command returns a list containing references for all of the models found under the specified point.
The optional levelOfDetail
parameter allows you to specify the level of detail of the information returned. The levelOfDetail
parameter can have the following values:
#simple returns a list containing references to the models found under the point. This is the default setting.
#detailed returns a list of property lists, each representing an intersected model. Each property list will have the following properties:
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
Within the returned list, the first model listed is the one closest to the viewer and the last model listed is the furthest from the viewer.
Only one intersection (the closest intersection) is returned per model.
The command returns an empty list if there are no models found under the specified point.
Example
The first line in this handler translates the location of the cursor from a point on the Stage to a point within sprite 5. The second line uses the modelsUnderLoc
command to obtain the first three models found under that point. The third line displays the returned detailed information about the models in the message window.
on mouseUp pt = the mouseLoc - point(sprite(5).left, sprite(5).top) m = sprite(5).camera.modelsUnderLoc(pt, 3, #detailed) put m end
See also
![]() ![]() ![]() |