Class reference

LookAtModifier3D

Inherits SkeletonModifier3D

The LookAtModifier3D rotates a bone to look at a target.

Description

This SkeletonModifier3D rotates a bone to look at a target. This is helpful for moving a character's head to look at the player, rotating a turret to look at a target, or any other case where you want to make a bone rotate towards something quickly and easily. When applying multiple LookAtModifier3Ds, the LookAtModifier3D assigned to the parent bone must be put above the LookAtModifier3D assigned to the child bone in the list in order for the child bone results to be correct.

Properties

String bone_name = ""

The bone name of the Skeleton3D that the modification will operate on.

float duration = 0.0

The duration of the time-based interpolation. Interpolation is triggered at the following cases: - When the target node is changed - When an axis is flipped due to angle limitation Note: The flipping occurs when the target is outside the angle limitation and the internally computed secondary rotation axis of the forward vector is flipped. Visually, it occurs when the target is outside the angle limitation and crosses the plane of the forward_axis and primary_rotation_axis.

int ease_type = 0

The ease type of the time-based interpolation. See also Tween.EaseType.

int origin_from = 0

This value determines from what origin is retrieved for use in the calculation of the forward vector.

Vector3 origin_offset = Vector3(0, 0, 0)

The offset of the bone pose origin. Matching the origins by offset is useful for cases where multiple bones must always face the same direction, such as the eyes. Note: This value indicates the local position of the object set in origin_from.

float origin_safe_margin = 0.1

If the target passes through too close to the origin than this value, time-based interpolation is used even if the target is within the angular limitations, to prevent the angular velocity from becoming too high.

float primary_damp_threshold

The threshold to start damping for primary_limit_angle. It provides non-linear (b-spline) interpolation, let it feel more resistance the more it rotate to the edge limit. This is useful for simulating the limits of human motion. If 1.0, no damping is performed. If 0.0, damping is always performed.

float primary_negative_limit_angle

The limit angle of negative side of the primary rotation when symmetry_limitation is false.

float primary_positive_limit_angle

The limit angle of positive side of the primary rotation when symmetry_limitation is false.

int primary_rotation_axis = 1

The axis of the first rotation. This SkeletonModifier3D works by compositing the rotation by Euler angles to prevent to rotate the forward_axis.

bool relative = true

The relative option. If true, the rotation is applied relative to the pose. If false, the rotation is applied relative to the rest. It means to replace the current pose with the LookAtModifier3D's result.

float secondary_negative_limit_angle

The limit angle of negative side of the secondary rotation when symmetry_limitation is false.

float secondary_positive_limit_angle

The limit angle of positive side of the secondary rotation when symmetry_limitation is false.

bool symmetry_limitation

If true, the limitations are spread from the bone symmetrically. If false, the limitation can be specified separately for each side of the bone rest.

NodePath target_node = NodePath("")

The NodePath to the node that is the target for the look at modification. This node is what the modification will rotate the bone to.

bool use_angle_limitation = false

If true, limits the amount of rotation. For example, this helps to prevent a character's neck from rotating 360 degrees. Note: As with AnimationTree blending, interpolation is provided that favors Skeleton3D.get_bone_rest(). This means that interpolation does not select the shortest path in some cases. Note: Some values for transition_type (such as Tween.TRANS_BACK, Tween.TRANS_ELASTIC, and Tween.TRANS_SPRING) may exceed the limitations. If interpolation occurs while overshooting the limitations, the result might not respect the bone rest.

bool use_secondary_rotation = true

If true, provides rotation by two axes.

Methods

float get_interpolation_remaining() const

Returns the remaining seconds of the time-based interpolation.

Constants

ORIGIN_FROM_SELF = 0

Enum: OriginFrom

The bone rest position of the bone specified in bone is used as origin.

ORIGIN_FROM_SPECIFIC_BONE = 1

Enum: OriginFrom

The bone global pose position of the bone specified in origin_bone is used as origin. Note: It is recommended that you select only the parent bone unless you are familiar with the bone processing process. The specified bone pose at the time the LookAtModifier3D is processed is used as a reference. In other words, if you specify a child bone and the LookAtModifier3D causes the child bone to move, the rendered result and direction will not match.

Source revision 5592dc3a7a61
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.