3D Lingo Dictionary > L-N > modelsUnderRay |
![]() ![]() ![]() |
modelsUnderRay
Syntax
member(whichCastmember
).modelsUnderRay(locationVector
,directionVector
{,maxNumberOfModels
,levelOfDetail
})
Description
3D command; returns a list of models found under a ray drawn from the position specified by locationVector
and pointing in the direction of directionVector
, with both vectors being specified in world-relative coordinates.
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 ray.
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 position specified by locationVector
and the last model listed is the furthest from that position.
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 ray.
Example
This statement displays the detailed information for a model intersected by a ray drawn from the position vector (0, 0, 300) and pointing down the -Z axis.
put member("3d").modelsUnderRay(vector(0, 0, 300), vector(0, 0, -1), 3, #detailed) -- [[#model: model("mSphere"), #distance: 275.0000, #isectPosition: vector( 0.0000, 0.0000, 25.0000 ), #isectNormal: vector( -0.0775, 0.0161, 0.9969 ), #meshID: 1, #faceID: 229, #vertices: [vector( 0.0000, 0.0000, 25.0000 ), vector( -3.6851, 1.3097, 24.6922 ), vector( -3.9017, 0.2669, 24.6922 )], #uvCoord: [#u: 0.0000, #v: 0.0000]]]
See also
![]() ![]() ![]() |