SkeletonIK

SkeletonIK is used to place the end bone of a Skeleton bone chain at a certain point in 3D by rotating all bones in the chain accordingly.

A typical scenario for IK in games is to place a characters feet on the ground or a characters hands on a currently hold object. SkeletonIK uses FabrikInverseKinematic internally to solve the bone chain and applies the results to the Skeleton bones_global_pose_override property for all affected bones in the chain. If fully applied this overwrites any bone transform from Animations or bone custom poses set by users. The applied amount can be controlled with the interpolation property.

More...
@GodotBaseClass
struct SkeletonIK {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

getInterpolation
double getInterpolation()
getMagnetPosition
Vector3 getMagnetPosition()
getMaxIterations
long getMaxIterations()
getMinDistance
double getMinDistance()
getParentSkeleton
Skeleton getParentSkeleton()

Returns the parent Skeleton Node that was present when SkeletonIK entered the SceneTree. Returns null if the parent node was not a Skeleton Node when SkeletonIK entered the SceneTree.

getRootBone
String getRootBone()
getTargetNode
NodePath getTargetNode()
getTargetTransform
Transform getTargetTransform()
getTipBone
String getTipBone()
isOverrideTipBasis
bool isOverrideTipBasis()
isRunning
bool isRunning()

Returns true if SkeletonIK is applying IK effects on continues frames to the Skeleton bones. Returns false if SkeletonIK is stopped or start was used with the one_time parameter set to true.

isUsingMagnet
bool isUsingMagnet()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(SkeletonIK other)
opEquals
bool opEquals(typeof(null) n)
setInterpolation
void setInterpolation(double interpolation)
setMagnetPosition
void setMagnetPosition(Vector3 local_position)
setMaxIterations
void setMaxIterations(long iterations)
setMinDistance
void setMinDistance(double min_distance)
setOverrideTipBasis
void setOverrideTipBasis(bool _override)
setRootBone
void setRootBone(String root_bone)
setTargetNode
void setTargetNode(NodePathArg0 node)
setTargetTransform
void setTargetTransform(Transform target)
setTipBone
void setTipBone(String tip_bone)
setUseMagnet
void setUseMagnet(bool use)
start
void start(bool one_time)

Starts applying IK effects on each frame to the Skeleton bones but will only take effect starting on the next frame. If one_time is true, this will take effect immediately but also reset on the next frame.

stop
void stop()

Stops applying IK effects on each frame to the Skeleton bones and also calls Skeleton.clearBonesGlobalPoseOverride to remove existing overrides on all bones.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

interpolation
double interpolation [@property getter]
double interpolation [@property setter]

Interpolation value for how much the IK results are applied to the current skeleton bone chain. A value of 1.0 will overwrite all skeleton bone transforms completely while a value of 0.0 will visually disable the SkeletonIK. A value at or below 0.01 also calls Skeleton.clearBonesGlobalPoseOverride.

magnet
Vector3 magnet [@property getter]
Vector3 magnet [@property setter]

Secondary target position (first is target property or targetNode) for the IK chain. Use magnet position (pole target) to control the bending of the IK chain. Only works if the bone chain has more than 2 bones. The middle chain bone position will be linearly interpolated with the magnet position.

maxIterations
long maxIterations [@property getter]
long maxIterations [@property setter]

Number of iteration loops used by the IK solver to produce more accurate (and elegant) bone chain results.

minDistance
double minDistance [@property getter]
double minDistance [@property setter]

The minimum distance between bone and goal target. If the distance is below this value, the IK solver stops further iterations.

overrideTipBasis
bool overrideTipBasis [@property getter]
bool overrideTipBasis [@property setter]

If true overwrites the rotation of the tip bone with the rotation of the target (or targetNode if defined).

rootBone
String rootBone [@property getter]
String rootBone [@property setter]

The name of the current root bone, the first bone in the IK chain.

target
Transform target [@property getter]
Transform target [@property setter]

First target of the IK chain where the tip bone is placed and, if overrideTipBasis is true, how the tip bone is rotated. If a targetNode path is available the nodes transform is used instead and this property is ignored.

targetNode
NodePath targetNode [@property getter]
NodePath targetNode [@property setter]

Target node NodePath for the IK chain. If available, the node's current Transform is used instead of the target property.

tipBone
String tipBone [@property getter]
String tipBone [@property setter]

The name of the current tip bone, the last bone in the IK chain placed at the target transform (or targetNode if defined).

useMagnet
bool useMagnet [@property getter]
bool useMagnet [@property setter]

If true, instructs the IK solver to consider the secondary magnet target (pole target) when calculating the bone chain. Use the magnet position (pole target) to control the bending of the IK chain.

Static functions

_new
SkeletonIK _new()

Construct a new instance of SkeletonIK. Note: use memnew!SkeletonIK instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Detailed Description

# Apply IK effect automatically on every new frame (not the current) skeleton_ik_node.start()

# Apply IK effect only on the current frame skeleton_ik_node.start(true)

# Stop IK effect and reset bones_global_pose_override on Skeleton skeleton_ik_node.stop()

# Apply full IK effect skeleton_ik_node.set_interpolation(1.0)

# Apply half IK effect skeleton_ik_node.set_interpolation(0.5)

# Apply zero IK effect (a value at or below 0.01 also removes bones_global_pose_override on Skeleton) skeleton_ik_node.set_interpolation(0.0)

Meta