Accessibility
 
Home > Products > Director > Support > Intermediate Director 3D Features
Macromedia Director Support Center - Intermediate Director 3D Features
The Lingo picking functions

You can use five Lingo functions to create picking:

modelUnderLoc
modelsUnderLoc
modelUnderRay
spriteSpacetoWorldSpace
worldSpaceToSpriteSpace

 
modelUnderLoc
The modelUnderLoc function returns the name of the first model underneath the pointer or under some other specified 2D location within the sprite's bounding box.

The syntax for modelUnderLoc is as follows:

member(whichCastmember).camera(whichCamera).modelUnderLoc(pointWithinSprite)
sprite(whichSprite).camera.modelUnderLoc(pointWithinSprite)
 
modelsUnderLoc
The modelsUnderLoc function is similar to modelUnderLoc , but instead of returning the name of one model, the function returns a list of the models underneath the pointer or some other specified point. The list is in the order of the models' depth in the 3D world, with the model closest to the camera appearing first on the list.

The syntax for modelsUnderLoc is as follows:

member(whichCastmember).camera(whichCamera).
modelsUnderLoc(pointWithinSprite {, maxNumberOfModels})
sprite(whichSprite).camera.
modelsUnderLoc(pointWithinSprite {, maxNumberOfModels})

 
modelsUnderRay
The modelsUnderRay function returns a list of the models that a specified ray intersects. The ray can have any orientation inside the 3D world, because modelsUnderRay includes two parameters for the ray: its start point and its direction.

The syntax for modelsUnderRay is as follows:

member(whichCastmember).camera(whichCamera).
modelsUnderRay(locationVector,directionVector,optionalMaxNumberOfModels)
 
spriteSpaceToWorldSpace
The spriteSpaceToWorldSpace function takes a 2D loc and returns a 3D position vector.

The syntax for s priteSpaceToWorldSpace is as follows:

sprite(whichSprite).camera.spriteSpaceToWorldSpace(loc)
member(whichCastmember).camera(whichCamera).
spriteSpaceToWorldSpace(loc)

 
worldSpaceToSpriteSpace
You can think of the worldSpaceToSpriteSpace function as the opposite of spriteSpacetoWorldSpace in that it takes as 3D position vector and returns a 2D loc .

The syntax for worldSpaceToSpriteSpace is as follows:

sprite(whichSprite).camera.worldSpaceToSpriteSpace(vector)
member(whichCastmember).camera(whichCamera).
worldSpaceToSpriteSpace(vector)

To Table of Contents Forward to next document