3D Lingo Dictionary > O-S > position (transform) |  |

position (transform)

Syntax

    member(whichCastmember).node(whichNode).transform.position
    member(whichCastmember).node(whichNode).getWorldTransform().position
    transform.position

Description

3D property; allows you to get or set the positional component of a transform. A transform defines a scale, position and rotation within a given frame of reference. The default value of this property is `vector(0,0,0)`.

A node can be a camera, group, light or model object. Setting the `position` of a node's transform defines that object's position within the transform's frame of reference. Setting the position property of an object's world relative transform using `getWorldTransform().position` defines the object's position relative to the world origin. Setting the position property of an object's parent relative transform using `transform.position` defines the object's position relative to its parent node.

The `worldPosition` property of a model, light, camera or group object is a shortcut to the `getWorldTransform().position` version of this property for that object.

Examples

The following statement displays the parent-relative position of the model named Tire.

    put member("scene").model("Tire").transform.position
    -- vector(-15.000, -2.5000, 20.0000)

The following statement displays the world-relative position of the model named Tire.

    put member("scene").model("Tire").getWorldTransform().position
    -- vector(5.0000, -2.5000, -10.0000)

The following statements first store the world transform of the model named Tire in the variable `tempTransform`, then they display the position component of that transform.

    tempTransform = member("scene").model("Tire").getWorldTransform()
    put tempTransform.position
    -- vector(5.0000, -2.5000, -10.0000)

See also

`transform (property)`, `getWorldTransform()`, `rotation (transform)`, `scale (transform)`