3D Lingo Dictionary > T-Z > translate |
![]() ![]() ![]() |
translate
Syntax
member(whichCastmember
).node(whichNode
).translate(xIncrement
,yIncrement
,zIncrement
{
, relativeTo
}
) member(whichCastmember
).node(whichNode
).translate(translateVector
{
, relativeTo
}
)transform
.translate(xIncrement
,yIncrement
,zIncrement
{
, relativeTo
}
)transform
.translate(translateVector
{
, relativeTo
}
)
Description
3D command; applies a translation after the current positional, rotational, and scale offsets held by a referenced node's transform object or the directly referenced transform object. The translation must be specified as a set of three increments along the three corresponding axes. These increments may be specified explicitly in the form of xIncrement
, yIncrement
, and zIncrement
, or by a translateVector
, where the x component of the vector corresponds to the translation along the x axis, y about y axis, and z about z axis.
A node can be a camera, model, light or group object.
The optional relativeTo
parameter determines which coordinate system's axes are used to apply the desired translational changes. The relativeTo
parameter can have any of the following values:
![]() |
|
![]() |
|
![]() |
|
![]() |
|
Examples
This example constructs a transform using the transform command, then it initializes the transform's position and orientation in space before assigning the transform to the model named mars. Finally this example displays the resulting position of the model.
t =transform() t.transform.identity()t.transform.rotate(0, 90, 0)
t.
transform.translate(100, 0, 0) gbModel = member("scene").model("mars") gbModel.transform = t put gbModel.transform.position -- vector(100.0000, 0.0000, 0.0000)
This statement moves the model Bip 20 units along the x axis of its parent node.
put member("Scene").model("Bip").position -- vector( -38.5000, 21.2500, 2.0000) member("Scene").model("Bip").translate(20, 10, -0.5) put member("Scene").model("Bip").position -- vector( -18.5000, 31.2500, 1.5000)
See also
transform (property)
, preTranslate()
, scale (command)
, rotate
![]() ![]() ![]() |