User Guide
385
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:
• #model is a reference to the intersected model object.
• #distance is the distance from the world position specified by locationVector to the point
of intersection with the model.
• #isectPosition is a vector representing the world space position of the point of intersection.
• #isectNormal is the world space normal vector to the mesh at the point of intersection.
• #meshID is the meshID of the intersected mesh which can be used to index into the mesh list
of the
meshDeform modifier.
• #faceID is the face ID of the intersected face which can be used to index into the face list of
the
meshDeform modifier.
• #vertices is a 3-element list of vectors that represent the world space positions of the vertices
of the intersected face.
• #uvCoord is a property list with properties #u and #v that represent the u and v barycentric
coordinates of the face.
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
modelsUnderLoc, modelUnderLoc