MAXScript Language Reference > 3ds Max Objects > Animation Controllers > Constraints >

# LookAt_Constraint - superclass: RotationController

    LookAt_Constraint - superclass: RotationController; super-superclass:MAXWrapper - 11:0 - classID: #(8225, 0)

Value > MAXWrapper > RotationController > LookAt_Constraint

| Animation Controllers - Quick Navigation

The LookAt Constraint constrains an object's orientation so that it's always looking at another object.

Note

The old Look At Controller, which is a full transform controller, will be invisible to the user unless an old file is loaded. The new LookAt Constraint Controller is a rotation controller and NOT a TM controller which the old LookAt was. The old LookAt will be phased out.

At this time, old LookAt.IsPublic returns zero, so that the users won't see the old LookAt. However, the old MAX files will still load the old LookAt and the camera and the light will continue to use the old LookAt.

Also, assigning a node to the .lookat property of another node will create an old-style transform Look At Controller and not a LookAt Constraint.

Constructor

    LookAt_Constraint ...

Properties

    <LookAt_Constraint>.relative Boolean default: false -- boolean

Get/set the state of the "Keep Initial Offset" checkbox. When set to true , the original rotation of the object will be kept and the look at effect will be applied relatively to it. When set to false (default), the specified axis will be rotated absolutely to look at the target(s).

    <LookAt_Constraint>.lookat_vector_length Float default: 100.0 -- animatable; float; Vector_Length

Get/set the length of the lookat vector in the viewport either in generic units (when .viewline_length_abs is set to true , the default) or as percentage of the distance from the object to the target point.

    <LookAt_Constraint>.viewline_length_abs Boolean default: true -- boolean; Viewline_Abs

Get/set the state of the Viewline Length Absolute checkbox. When set to true (default), the lookat line in the viewport will have a length in absolute generic units. When set to false , the length will be relative to the distance from the object to the target. See .lookat_vector_length description above.

    <LookAt_Constraint>.set_orientation Boolean default: false -- boolean

Get/set the state of the Set Orientation checkbutton. When set to true , the Set Orientation checkbutton will be pressed and will allow the interactive adjustment of the initial rotation, provided the .relative property is set to false.

    <LookAt_Constraint>.target_axis Integer default: 0-- integer

Get/set thestate of theLookAt Axisradiobuttons.

Possible values are:

0 - X axis

1 - Y axis

2 - Z axis

    <LookAt_Constraint>.target_axisFlip Boolean default: false -- boolean

Get/set the state of theLookAt Axis >Flip checkbox. When set to true , the axis defined by .target_axis will be taken with negative sign: -X, -Y or -Z.

    <LookAt_Constraint>.pickUpNode UndefinedClass default: undefined -- node; Pick_Upnode

Get/set the Upnode.

    <LookAt_Constraint>.upnode_world Boolean default: true -- boolean

Get/set the state of the World checkbox in the Select Upnode group of controls. When set to true (default), the World Up Axis will be used. When set to false , the Upnode local axis will be used (if available).

    <LookAt_Constraint>.StoUP_axis Integer default: 0 -- integer

Get/set the state of the Source/Upnode Alignment > Source Axis radiobuttons.

Possible values are:

0 - X axis

1 - Y axis

2 - Z axis

    <LookAt_Constraint>.StoUP_axisFlip Boolean default: false -- boolean

Get/set the state of the Source/Upnode Alignment > Source Axis > Flip checkbox. When set to true , the axis defined by .StoUP_axis will be taken with negative sign: -X, -Y or -Z.

    <LookAt_Constraint>.upnode_axis Integer default: 2 -- integer

Get/set the stare of the Aligned To Upnode Axis radiobuttons.

Possible values are:

0 - X axis

1 - Y axis

2 - Z axis

LookAt_Constraint interfaces:

    Interface:constraints

Methods:

    <integer>getNumTargets ()

Returns the number of target nodes on the target list.

    <node>getNode <index>targetNumber

Returns the indexed target node.

    <float>getWeight <index>targetNumber

Returns the weight of the indexed target if the targetNumber is relevant, 0.0 otherwise.

    <boolean>setWeight <index>targetNumber<float>weight

Sets the weight of the indexed node specified by targetNumber . Returns true on success, false otherwise.

    <boolean>appendTarget <node>target <float>weight

Appends the specified node to the list and sets its weight to the specified value. Returns true on success, false otherwise.

    <boolean>deleteTarget <index>targetNumber

Deletes the indexed target. Returns true on success, false otherwise.

See Also Class IposConstPosition, in the SDK Help file accompanying this product.

#### See Also

- Link_Constraint : Matrix3Controller

- LookAt_Constraint : RotationController

- Path_Constraint : PositionController

- Position_Constraint : PositionController

- Orientation_Constraint : RotationController

- Controller Functions for Use with Constraint Assignments