AddCamera

From Director Online Wiki
Jump to: navigation, search
addCamera
Type: 3D sprite method
Version: 8.5 and up
Language: Lingo, JavaScript
Dependencies: none
Links/Related
camera.rect, cameraCount(), deleteCamera(), camera.colorbuffer.clearAtRender






Syntax

From Director 8.5 Documentation

 sprite(whichSprite).addCamera(whichCamera, integerIndex)

Description

3D command; adds the camera whichCamera at the given index position to the list of cameras for the sprite. If index is greater than the value of sprite(whichSprite).cameraCount(), the camera is added to the end of the list. The view from each camera is displayed on top of the view from cameras with lower index positions.

The default rect of a newly added camera is rect(0, 0, 1, 1). In order to display the camera view, you must set the .rect property of the camera to a value with a non-zero width and height.

Example

This example creates a new camera at the origin of the world, pointing down the world's zAxis, and displays its view in a 64 x 64 pixel insert at the top left of the 3D sprite.

 vSprite = sprite("3D")
 vMember = vSprite.member
 vCamera = vMember.newCamera("Insert")
 vIndex  = vSprite.cameraCount() + 1
 vSprite.addCamera(vCamera, vIndex)
 vCamera.rect = rect(0, 0, 64, 64)

Tricks and Tips

You can overlay one camera view over another by setting the camera's colorbuffer.clearAtRender property to FALSE.

See also

camera.rect, cameraCount(), deleteCamera(), camera.colorbuffer.clearAtRender

External links

  • []