Математика

Физика

Химия

Биология

Техника и    технологии

pointAt

Usage

member(whichCastmember).model(whichModel).pointAt\

(vectorPosition{, vectorUp})

member(whichCastmember).camera(whichCamera).pointAt\

(vectorPosition{, vectorUp})

member(whichCastmember).light(whichLight).pointAt\

(vectorPosition{, vectorUp})

member(whichCastmember).group(whichGroup).pointAt\

(vectorPosition{, vectorUp})

Description

3D command; rotates the referenced object so that its forward direction vector points at a

specified world relative position, then it rotates the referenced object to point it’s up direction

vector in the direction hinted at by a specified relative vector.

The object’s front and up direction vectors are defined by the object’s pointAtOrientation

property.

458 Chapter 12: Methods

Parameters

vectorPosition Required. Specifies the world relative position. This value can also be a

node reference.

vectorUp Optional. Specfies a world relative vector that hints at where the object’s up vector

should point. If this parameter isn’t specified, then pointAt defaults to using the world’s y axis as

the up hinting vector. If you attempt to point the object at a position such that the object’s

forward vector is parallel to the world’s y axis, then the world’s x axis is used as the up

hinting vector. The direction at which you wish to point the object’s forward direction and the

direction specified by vectorUp do not need to be perpendicular to each other being as this

command only uses the vectorUp parameter as a hinting vector.

Example

This example points three objects at the model named Mars: the camera named MarsCam, the

light named BrightSpot, and the model named BigGun:

thisWorldPosn = member(“Scene”).model(“Mars”).worldPosition

member("Scene").camera("MarsCam").pointAt(thisWorldPosn)

member("Scene").light("BrightSpot").pointAt(thisWorldPosn)

member("Scene").model("BigGun").pointAt(thisWorldPosn, \

vector(0,0,45))

If you use non-uniform scaling and a custom pointAtOrientation on the same node, e.g., a

model, using pointAt will likely cause unexpected non-uniform scaling. This is due to the order

in which the non-uniform scaling and the rotation to properly orient the node are applied. To

workaround this issue, do one of the following:

• Avoid using non-uniform scaling and non-default pointAtOrientation together on the

same node.

• Remove your scale prior to using pointAt, and then reapply it afterwards.

For example:

scale = node.transform.scale

node.scale = vector( 1, 1, 1 )

node.pointAt(vector(0, 0, 0)) -- non-default pointAtOrientation

node.transform.scale = scale

Назад

 

 

Hosted by uCoz