SkeletonModification2DLookAt
A modification that rotates a Bone2D
node to look at a target.
class SkeletonModification2DLookAt
This SkeletonModification2D
rotates a bone to look a target. This is extremely helpful for moving 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.
Superclasses
class SkeletonModification2D
Base class for resources that operate on
Bone2D
s in aSkeleton2D
.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var bone2dNode: NodePath
The
Bone2D
node that the modification will operate on.var boneIndex: Int32
The index of the
Bone2D
node that the modification will operate on.var targetNodepath: NodePath
The NodePath to the node that is the target for the LookAt modification. This node is what the modification will rotate the
Bone2D
to.func getAdditionalRotation(
) -> Double Returns the amount of additional rotation that is applied after the LookAt modification executes.
func getConstraintAngleInvert(
) -> Bool Returns whether the constraints to this modification are inverted or not.
func getConstraintAngleMax(
) -> Double Returns the constraint’s maximum allowed angle.
func getConstraintAngleMin(
) -> Double Returns the constraint’s minimum allowed angle.
func getEnableConstraint(
) -> Bool Returns
true
if the LookAt modification is using constraints.func setAdditionalRotation(Double
) Sets the amount of additional rotation that is to be applied after executing the modification. This allows for offsetting the results by the inputted rotation amount.
func setConstraintAngleInvert(Bool
) When
true
, the modification will use an inverted joint constraint.func setConstraintAngleMax(Double
) Sets the constraint’s maximum allowed angle.
func setConstraintAngleMin(Double
) Sets the constraint’s minimum allowed angle.
func setEnableConstraint(Bool
) Sets whether this modification will use constraints or not. When
true
, constraints will be applied when solving the LookAt modification.