07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ADOBE DIRECTOR BASICS<br />

3D: Controlling appearance<br />

-- Lingo<br />

v3DSprite = sprite("3D")<br />

v3DMember = v3DSprite.member<br />

vCamera = v3DMember.newCamera("Top Down")<br />

vCamera.projectionAngle = 45.0<br />

vCamera.worldPosition = vector(0, 250, 1)<br />

vCamera.pointAt(0, 0, 0)<br />

// JavaScript<br />

v3DSprite = sprite("3D");<br />

v3DMember = v3DSprite.member;<br />

vCamera = v3DMember.newCamera("Top Down");<br />

vCamera.projectionAngle = 45.0;<br />

vCamera.worldPosition = vector(0, 250, 10);<br />

vCamera.pointAt(0, 0, 0);<br />

Rendering a secondary camera in the 3D sprite<br />

The view from the new camera is automatically rendered to the 3D sprite. You need to provide two additional<br />

instructions. Here are the scripting terms you need to use: sprite3d.addCamera() and camera.rect.<br />

The following example creates an inset at the top left corner of sprite(“3D”) to show the output of the new camera<br />

(“Top Down”):<br />

-- Lingo<br />

v3DSprite = sprite("3D")<br />

vCamera = v3DSprite.member.camera("Top Down")<br />

v3DSprite.addCamera(vCamera)<br />

vCamera.rect = rect(0, 0, 160, 120)<br />

// JavaScript<br />

v3DSprite = sprite("3D");<br />

vCamera = v3DSprite.member.getPropRef("camera", 2);<br />

v3DSprite.addCamera(vCamera);<br />

vCamera.rect = rect(0, 0, 160, 120);<br />

All sprites that display the same 3D cast member display the same secondary camera views. It is not advisable to use<br />

the same camera as the main view for one sprite and as a secondary camera for another sprite. The dimensions of the<br />

sprite where the camera is used for the main view affects the camera.rect for the secondary view in the other sprite. The<br />

two views will have the same dimensions. You can set the rect of the primary camera of a 3D sprite, but you may get<br />

unexpected results if you make the dimensions of the camera.rect smaller than the dimensions of the sprite.<br />

Deleting a secondary camera view<br />

To remove a camera that you have added to a 3D sprite, you can use sprite3d.deleteCamera(). This will remove the<br />

secondary camera view from all sprites that display the same 3D cast member. It will not delete the camera from the<br />

3D cast member itself.<br />

Color buffer<br />

Every camera has a colorBuffer property. You cannot access this directly, but you can get and set the values of its two<br />

properties:<br />

camera.colorBuffer.clearValue<br />

camera.colorBuffer.clearAtRender<br />

The clearValue property defines a fill color and clearAtRender determines whether that color is used to fill in any blank<br />

spaces behind visible models.<br />

Last updated 8/26/2011<br />

105

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!