LookAtModifier3D

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsLookAtModifier3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsLookAtModifier3D

func (self *Extension[T]) AsLookAtModifier3D() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsSkeletonModifier3D

func (self *Extension[T]) AsSkeletonModifier3D() SkeletonModifier3D.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.LookAtModifier3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsLookAtModifier3D

func (self Instance) AsLookAtModifier3D() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsSkeletonModifier3D

func (self Instance) AsSkeletonModifier3D() SkeletonModifier3D.Instance

func (Instance) Bone

func (self Instance) Bone() int

Index of the BoneName in the parent Skeleton3D.

func (Instance) BoneName

func (self Instance) BoneName() string

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

func (Instance) Duration

func (self Instance) Duration() Float.X

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 ForwardAxis and PrimaryRotationAxis.

func (Instance) EaseType

func (self Instance) EaseType() Tween.EaseType

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

func (Instance) ForwardAxis

func (self Instance) ForwardAxis() SkeletonModifier3D.BoneAxis

The forward axis of the bone. This SkeletonModifier3D modifies the bone so that this axis points toward the TargetNode.

func (Instance) GetInterpolationRemaining

func (self Instance) GetInterpolationRemaining() Float.X

Returns the remaining seconds of the time-based interpolation.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsInterpolating

func (self Instance) IsInterpolating() bool

Returns true if time-based interpolation is running. If true, it is equivalent to GetInterpolationRemaining returning 0.0.

This is useful to determine whether a LookAtModifier3D can be removed safely.

func (Instance) IsTargetWithinLimitation

func (self Instance) IsTargetWithinLimitation() bool

Returns whether the target is within the angle limitations. It is useful for unsetting the TargetNode when the target is outside of the angle limitations.

Note: The value is updated after SkeletonModifier3D.ProcessModification. To retrieve this value correctly, we recommend using the signal OnSkeletonmodifier3d.ModificationProcessed.

func (Instance) OriginBone

func (self Instance) OriginBone() int

Index of the OriginBoneName in the parent Skeleton3D.

func (Instance) OriginBoneName

func (self Instance) OriginBoneName() string

If OriginFrom is OriginFromSpecificBone, the bone global pose position specified for this is used as origin.

func (Instance) OriginExternalNode

func (self Instance) OriginExternalNode() string

If OriginFrom is OriginFromExternalNode, the global position of the Node3D specified for this is used as origin.

func (Instance) OriginFrom

func (self Instance) OriginFrom() OriginFrom

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

func (Instance) OriginOffset

func (self Instance) OriginOffset() Vector3.XYZ

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 OriginFrom.

func (Instance) OriginSafeMargin

func (self Instance) OriginSafeMargin() Float.X

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.

func (Instance) PrimaryDampThreshold

func (self Instance) PrimaryDampThreshold() Float.X

The threshold to start damping for PrimaryLimitAngle. 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.

func (Instance) PrimaryLimitAngle

func (self Instance) PrimaryLimitAngle() Angle.Radians

The limit angle of the primary rotation when SymmetryLimitation is true.

func (Instance) PrimaryNegativeDampThreshold

func (self Instance) PrimaryNegativeDampThreshold() Float.X

The threshold to start damping for PrimaryNegativeLimitAngle.

func (Instance) PrimaryNegativeLimitAngle

func (self Instance) PrimaryNegativeLimitAngle() Angle.Radians

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

func (Instance) PrimaryPositiveDampThreshold

func (self Instance) PrimaryPositiveDampThreshold() Float.X

The threshold to start damping for PrimaryPositiveLimitAngle.

func (Instance) PrimaryPositiveLimitAngle

func (self Instance) PrimaryPositiveLimitAngle() Angle.Radians

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

func (Instance) PrimaryRotationAxis

func (self Instance) PrimaryRotationAxis() Vector3.Axis

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

func (Instance) SecondaryDampThreshold

func (self Instance) SecondaryDampThreshold() Float.X

The threshold to start damping for SecondaryLimitAngle.

func (Instance) SecondaryLimitAngle

func (self Instance) SecondaryLimitAngle() Angle.Radians

The limit angle of the secondary rotation when SymmetryLimitation is true.

func (Instance) SecondaryNegativeDampThreshold

func (self Instance) SecondaryNegativeDampThreshold() Float.X

The threshold to start damping for SecondaryNegativeLimitAngle.

func (Instance) SecondaryNegativeLimitAngle

func (self Instance) SecondaryNegativeLimitAngle() Angle.Radians

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

func (Instance) SecondaryPositiveDampThreshold

func (self Instance) SecondaryPositiveDampThreshold() Float.X

The threshold to start damping for SecondaryPositiveLimitAngle.

func (Instance) SecondaryPositiveLimitAngle

func (self Instance) SecondaryPositiveLimitAngle() Angle.Radians

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

func (Instance) SetBone

func (self Instance) SetBone(value int)

SetBone sets the property returned by [GetBone].

func (Instance) SetBoneName

func (self Instance) SetBoneName(value string)

SetBoneName sets the property returned by [GetBoneName].

func (Instance) SetDuration

func (self Instance) SetDuration(value Float.X)

SetDuration sets the property returned by [GetDuration].

func (Instance) SetEaseType

func (self Instance) SetEaseType(value Tween.EaseType)

SetEaseType sets the property returned by [GetEaseType].

func (Instance) SetForwardAxis

func (self Instance) SetForwardAxis(value SkeletonModifier3D.BoneAxis)

SetForwardAxis sets the property returned by [GetForwardAxis].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetOriginBone

func (self Instance) SetOriginBone(value int)

SetOriginBone sets the property returned by [GetOriginBone].

func (Instance) SetOriginBoneName

func (self Instance) SetOriginBoneName(value string)

SetOriginBoneName sets the property returned by [GetOriginBoneName].

func (Instance) SetOriginExternalNode

func (self Instance) SetOriginExternalNode(value string)

SetOriginExternalNode sets the property returned by [GetOriginExternalNode].

func (Instance) SetOriginFrom

func (self Instance) SetOriginFrom(value OriginFrom)

SetOriginFrom sets the property returned by [GetOriginFrom].

func (Instance) SetOriginOffset

func (self Instance) SetOriginOffset(value Vector3.XYZ)

SetOriginOffset sets the property returned by [GetOriginOffset].

func (Instance) SetOriginSafeMargin

func (self Instance) SetOriginSafeMargin(value Float.X)

SetOriginSafeMargin sets the property returned by [GetOriginSafeMargin].

func (Instance) SetPrimaryDampThreshold

func (self Instance) SetPrimaryDampThreshold(value Float.X)

SetPrimaryDampThreshold sets the property returned by [GetPrimaryDampThreshold].

func (Instance) SetPrimaryLimitAngle

func (self Instance) SetPrimaryLimitAngle(value Angle.Radians)

SetPrimaryLimitAngle sets the property returned by [GetPrimaryLimitAngle].

func (Instance) SetPrimaryNegativeDampThreshold

func (self Instance) SetPrimaryNegativeDampThreshold(value Float.X)

SetPrimaryNegativeDampThreshold sets the property returned by [GetPrimaryNegativeDampThreshold].

func (Instance) SetPrimaryNegativeLimitAngle

func (self Instance) SetPrimaryNegativeLimitAngle(value Angle.Radians)

SetPrimaryNegativeLimitAngle sets the property returned by [GetPrimaryNegativeLimitAngle].

func (Instance) SetPrimaryPositiveDampThreshold

func (self Instance) SetPrimaryPositiveDampThreshold(value Float.X)

SetPrimaryPositiveDampThreshold sets the property returned by [GetPrimaryPositiveDampThreshold].

func (Instance) SetPrimaryPositiveLimitAngle

func (self Instance) SetPrimaryPositiveLimitAngle(value Angle.Radians)

SetPrimaryPositiveLimitAngle sets the property returned by [GetPrimaryPositiveLimitAngle].

func (Instance) SetPrimaryRotationAxis

func (self Instance) SetPrimaryRotationAxis(value Vector3.Axis)

SetPrimaryRotationAxis sets the property returned by [GetPrimaryRotationAxis].

func (Instance) SetSecondaryDampThreshold

func (self Instance) SetSecondaryDampThreshold(value Float.X)

SetSecondaryDampThreshold sets the property returned by [GetSecondaryDampThreshold].

func (Instance) SetSecondaryLimitAngle

func (self Instance) SetSecondaryLimitAngle(value Angle.Radians)

SetSecondaryLimitAngle sets the property returned by [GetSecondaryLimitAngle].

func (Instance) SetSecondaryNegativeDampThreshold

func (self Instance) SetSecondaryNegativeDampThreshold(value Float.X)

SetSecondaryNegativeDampThreshold sets the property returned by [GetSecondaryNegativeDampThreshold].

func (Instance) SetSecondaryNegativeLimitAngle

func (self Instance) SetSecondaryNegativeLimitAngle(value Angle.Radians)

SetSecondaryNegativeLimitAngle sets the property returned by [GetSecondaryNegativeLimitAngle].

func (Instance) SetSecondaryPositiveDampThreshold

func (self Instance) SetSecondaryPositiveDampThreshold(value Float.X)

SetSecondaryPositiveDampThreshold sets the property returned by [GetSecondaryPositiveDampThreshold].

func (Instance) SetSecondaryPositiveLimitAngle

func (self Instance) SetSecondaryPositiveLimitAngle(value Angle.Radians)

SetSecondaryPositiveLimitAngle sets the property returned by [GetSecondaryPositiveLimitAngle].

func (Instance) SetSymmetryLimitation

func (self Instance) SetSymmetryLimitation(value bool)

SetSymmetryLimitation sets the property returned by [IsLimitationSymmetry].

func (Instance) SetTargetNode

func (self Instance) SetTargetNode(value string)

SetTargetNode sets the property returned by [GetTargetNode].

func (Instance) SetTransitionType

func (self Instance) SetTransitionType(value Tween.TransitionType)

SetTransitionType sets the property returned by [GetTransitionType].

func (Instance) SetUseAngleLimitation

func (self Instance) SetUseAngleLimitation(value bool)

SetUseAngleLimitation sets the property returned by [IsUsingAngleLimitation].

func (Instance) SetUseSecondaryRotation

func (self Instance) SetUseSecondaryRotation(value bool)

SetUseSecondaryRotation sets the property returned by [IsUsingSecondaryRotation].

func (Instance) SymmetryLimitation

func (self Instance) SymmetryLimitation() bool

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.

func (Instance) TargetNode

func (self Instance) TargetNode() string

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

func (Instance) TransitionType

func (self Instance) TransitionType() Tween.TransitionType

The transition type of the time-based interpolation. See also [Tween.TransitionType].

func (Instance) UseAngleLimitation

func (self Instance) UseAngleLimitation() bool

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.GetBoneRest. This means that interpolation does not select the shortest path in some cases.

Note: Some values for TransitionType (such as [Tween.TransBack], [Tween.TransElastic], and [Tween.TransSpring]) may exceed the limitations. If interpolation occurs while overshooting the limitations, the result might not respect the bone rest.

func (Instance) UseSecondaryRotation

func (self Instance) UseSecondaryRotation() bool

If true, provides rotation by two axes.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type OriginFrom

type OriginFrom int //gd:LookAtModifier3D.OriginFrom
const (
	// The bone rest position of the bone specified in [Bone] is used as origin.
	//
	// [Bone]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Bone
	OriginFromSelf OriginFrom = 0
	// The bone global pose position of the bone specified in [OriginBone] 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.
	//
	// [LookAtModifier3D]: https://pkg.go.dev/graphics.gd/classdb/LookAtModifier3D
	// [OriginBone]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OriginBone
	OriginFromSpecificBone OriginFrom = 1
	// The global position of the [Node3D] specified in [OriginExternalNode] is used as origin.
	//
	// Note: Same as [OriginFromSpecificBone], when specifying a [BoneAttachment3D] with a child bone assigned, the rendered result and direction will not match.
	//
	// [BoneAttachment3D]: https://pkg.go.dev/graphics.gd/classdb/BoneAttachment3D
	// [Node3D]: https://pkg.go.dev/graphics.gd/classdb/Node3D
	// [OriginExternalNode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OriginExternalNode
	OriginFromExternalNode OriginFrom = 2
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL