07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ADOBE DIRECTOR BASICS<br />

3D: Controlling appearance<br />

-- Lingo and JavaScript syntax<br />

vExtruder = member("Text to Extrude").extrude3D(member("3D"))<br />

vModel = member("3D").newModel("Extrusion", vExtruder)<br />

vExtruder.vertexList = member("VectorShape").vertexList<br />

In <strong>Director</strong> 11.5, extruderResource.vertexList is a write-only property. You cannot retrieve the vertexList from an<br />

extruder resource after it is set, as the following examples show:<br />

-- Lingo syntax<br />

put member("3D").model("Extruded").resource.vertexList<br />

-- <br />

// JavaScript syntax<br />

trace(member("3D").getPropRef("model", 1).resource.vertexList);<br />

// null<br />

To see an example of this in action, download and launch the movie Extruder.dir.<br />

Note: The 2D co-ordinates of a vectorShape member are measured only rightwards and downwards, whereas the 3D coordinates<br />

of a model resource are measured rightwards, upwards, and forwards. As a result, the shape of an #extruder<br />

resource appears to be flipped vertically.<br />

Texture mapping<br />

An #extruder resource has only one mesh. The same shader is applied to both front and back, as a mirror image, and<br />

it is smeared along the sides. If you want to create an modelResource that appears to be extruded, and which has<br />

separate shaders on the front, back and tunnel, use a #mesh resource. See “Creating a mesh resource” on page 170 for<br />

details.<br />

Creating a mesh resource<br />

The mesh generator is the most complex model resource. It allows you to create models with unique geometries at<br />

runtime. Some examples of typical uses are:<br />

Mathematically simple volumes<br />

Lathed shapes<br />

Walls for a building<br />

Low-polygon models used for collision detection<br />

Terrain meshes<br />

Writing a script to create a custom mesh requires a good visualization of 3D space, a good grasp of a number of lowlevel<br />

3D concepts, concentration, and plenty of patience. However, you can find scripts that generate a mesh for you,<br />

from information that you provide in some of the demo movies that accompany this manual.<br />

Do-it-yourself mesh movies<br />

See “Mesh resources” on page 72 for a movie that allows you to create a 2D shape by setting points in a vectorShape<br />

member, and then transforms this into a 3D model by rotating the 2D shape around a vertical axis. The movie can<br />

generate scripts which recreate the models in your own movies.<br />

See “Not walking through objects” on page 222 for a script that generates a low-polygon ribbon mesh for use with<br />

collision detection. The script uses the vertexPoints of a VectorShape member to generate the shape of the ribbon.<br />

See “Following a pre-defined path” on page 220 for scripts that generate a tube from a curve defined by a<br />

vectorShape member.<br />

Last updated 8/26/2011<br />

170

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

Saved successfully!

Ooh no, something went wrong!