3D Lingo Dictionary > O-S > rect

 

rect

Syntax

sprite(whichSprite).camera(whichCamera).rect

Description

3D camera property; allows you to get or set the rectangle that controls the size and position of the camera. This rectangle is analogous to the rectangle you see through the eyepiece of a real camera.

The default value for the rect property for all cameras rect(0,0,1,1) which makes them invisible until you change the setting. However, when sprite.camera(1) is rendered, its rect is reset to rect(0, 0, sprite(whichSprite).width, sprite(whichSprite).height) so that the camera fills the screen. All camera rect coordinates are given relative to the top left corner of the sprite.

Note that if whichCamera is greater than 1, the rect is not scaled when the sprite is scaled, so it will be necessary to manage that in Lingo if desired.

When whichCamera is greater than 1, the rect.top and rect.left properties must be greater than or equal to the rect.top and rect.left settings for sprite.camera(1).

Example

This statement sets the rect of the default camera of sprite 5 to rect(0, 0, 200, 550):

sprite(5).camera.rect = rect(0, 0, 200, 550)

See also

cameraPosition, cameraRotation