3D Lingo Dictionary > O-S > preRotate

 

preRotate

Syntax

transformReference.preRotate( xAngle, yAngle, zAngle )
transformReference.preRotate( vector )
transformReference.preRotate( positionVector, directionVector, angle )
member( whichCastmember ).node.transform.preRotate( xAngle, yAngle, zAngle )
member( whichCastmember ).node.transform.preRotate( vector )
member( whichCastmember ).node.transform.preRotate( positionVector, directionVector, angle )

Description

3D transform command; applies a rotation before the current positional, rotational, and scale offsets held by the referenced transform object. The rotation may be specified as a set of three angles, each of which specify an angle of rotation about the three corresponding axes. These angles may be specified explicitly in the form of xAngle, yAngle, and zAngle, or by a vector, where the x component of the vector corresponds to the rotation about the x axis, the y about the y axis, and the z about the z axis.

Alternatively, the rotation may also be specified as a rotation about an arbitrary axis. This axis is defined in space by positionVector and directionVector. The amount of rotation about this axis is specified by angle.

Node may be a reference to a model, group, light, or camera

Example

This line performs a rotation of 20 degrees about each axis. Since the model's transform property is its position, rotation, and scale offsets relative to that model's parent, and preRotate applies the change in orientation prior to any existing effects of that model's transform, this will rotate the model in place rather than orbiting around its parent.

member("scene").model("bip01").transform.preRotate(20, 20, 20)

Note that the above is equivalent to:

member("scene").model("bip01").rotate(20,20,20). 

Generally preRotate() is only useful when dealing with transform variables. This line will orbit the camera about the point (100, 0, 0) in space, around the y axis, by 180 degrees.

t = transform()
t.position = member("scene").camera[1].transform.position
t.preRotate(vector(100, 0, 0), vector(0, 1, 0), 180) 
member("scene").camera[1].transform = t

See also

rotate