or
car.child[1].rotate(0,10,0, #self)
where the fourth parameter of the
relative to.
•
Parent-relative: A model's
the model's parent. If you want the wheels of the car to move outward regardless of how the
wheels are turned, use
car.child[1].transform.translate(10,0,0)
the sun to orbit around the sun, use
•
World-relative: If you want the car to move along the world's x-axis regardless of which way it
is facing, use
model.translate(10,0,0,#world)
the world y-axis, with the rotation taking place at the world location vector (10, 10, 10), use
model.rotate(vector(10,10,10), vector(0,1,0), 20, #world)
•
Relative to another object: If you want to move an object so that it goes toward the right edge
of the screen, use
to rotate the object parallel to the camera and around the center of the screen, use
model.rotate(vector(0,0,0), vector(0,0,1), 20, sprite(1).camera)
Shaders
A model resource defines a model's shape, and shaders define the model's surface colors and
reflectivity. You can use just one shader or more than one. Each mesh in a model resource can
have its own shader. For example, a box might have six different shaders, one for each mesh (a box
is actually composed of 6 plane meshes carefully arranged). If you do not specify a shader, the
default
#standard
models that use that shader.
Models that are created with script are assigned the standard shader. You can replace the default
shader of a model with any of the other types of shaders.
Properties of the standard shader
The standard shader makes the surface of a model appear in a photorealistic style. Use these
properties to work with the standard shader:
Property Name
name
ambient
diffuse
specular
352
Chapter 16: Working with Models and Model Resources
rotate
property expresses its position and rotation relative to
transform
car.child[1].translate(10,0,0,#parent)
planet.rotate(0,5,0, #parent)
model.translate (vector(10,0,0), sprite(1).camera)
shader is used. If the shader's properties are modified, the change affects all
Access
Description
Get
The string name of this shader.
Get and set
A color object describing the surface's
reaction to ambient light.
Get and set
A color object describing the surface's
reaction to diffuse light. Ambient and
diffuse color objects together describe a
model resource's base color.
Get and set
A color object describing the surface's
specular highlight color. This setting has
an effect only if there are lights in the
scene whose specular property is
(1)
method is the object the rotation should be
. If you want a planet model that is a child of
. If you want to rotate the car 20° around
.
or
.
.
. If you want
.
Default
None
color(63,63,
63)
color(255,
255,255)
color(255,
255,255)
TRUE
Need help?
Do you have a question about the DIRECTOR MX 2004-USING DIRECTOR and is the answer not in the manual?
Questions and answers