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

rotation (transform)

Syntax

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

Description

3D property; allows you to get or set the rotational 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 `rotation` of a node's transform defines that object's rotation within the transform's frame of reference. Setting the `rotation` property of an object's world relative transform using `getWorldTransform().rotation` defines the object's rotation relative to the world origin. Setting the `rotation` property of an object's parent relative transform using `transform.rotation` defines the object's rotation relative to its parent node.

If you wish to modify the orientation of a transform it is recommended that you use the `rotate` and `prerotate` methods instead of setting this property.

Examples

This statement sets the parent-relative rotation of the first camera in the member to `vector(0,0,0)`.

    member("Space").camera[1].transform.rotation = vector(0, 0, 0)

This example displays the parent-relative rotation of the model named Moon, then it adjusts the model's orientation using the rotate command, finally it displays the resulting world-relative rotation of the model.

    put member("SolarSys").model("Moon").transform.rotation
    -- vector( 0.0000, 0.0000, 45.0000)
    member("SolarSys").model("Moon").rotate(15,15,15)
    put member("SolarSys").model("Moon").getWorldTransform().rotation
    --vector( 51.3810, 16.5191, 65.8771 )

See also

`getWorldTransform()`, `preRotate`, `rotate`, `transform (property)`, `position (transform)`, `scale (transform)`