3D Lingo Dictionary > L-N > modelUnderLoc |  |

modelUnderLoc

Syntax

    member(whichCastmember).camera(whichCamera).modelUnderLoc(pointWithinSprite)

Description

3D command; returns a reference to the first model 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.

This command returns `void` if there is no model found under the specified point.

For a list of all of the models found under a specified point, and detailed information about them, use `modelsUnderLoc`.

Examples

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 determines the first model under that point. The third line displays the result in the message window.

    on mouseUp
    	pt = the mouseLoc - point(sprite(5).left, sprite(5).top)
    	m = sprite(5).camera.modelUnderLoc(pt)
    	put m
    end

See also

`modelsUnderLoc`, `modelsUnderRay`