Class SkeletonIK3D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
SkeletonIK3D is used to rotate all bones of a Skeleton3D bone chain a way that places the end bone at a desired 3D position. A typical scenario for IK in games is to place a character's feet on the ground or a character's hands on a currently held object. SkeletonIK uses FabrikInverseKinematic internally to solve the bone chain and applies the results to the Skeleton3Dbones_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.
# 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)
Deprecated. This class is deprecated, and might be removed in a future release.
[Obsolete("This class is deprecated.")]
public class SkeletonIK3D : Node, IDisposable
- Inheritance
-
SkeletonIK3D
- Implements
- Inherited Members
Constructors
SkeletonIK3D()
public SkeletonIK3D()
Properties
Interpolation
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 ClearBonesGlobalPoseOverride().
public float Interpolation { get; set; }
Property Value
Magnet
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.
public Vector3 Magnet { get; set; }
Property Value
MaxIterations
Number of iteration loops used by the IK solver to produce more accurate (and elegant) bone chain results.
public int MaxIterations { get; set; }
Property Value
MinDistance
The minimum distance between bone and goal target. If the distance is below this value, the IK solver stops further iterations.
public float MinDistance { get; set; }
Property Value
OverrideTipBasis
If true
overwrites the rotation of the tip bone with the rotation of the Target (or TargetNode if defined).
public bool OverrideTipBasis { get; set; }
Property Value
RootBone
The name of the current root bone, the first bone in the IK chain.
public StringName RootBone { get; set; }
Property Value
Target
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.
public Transform3D Target { get; set; }
Property Value
TargetNode
Target node NodePath for the IK chain. If available, the node's current Transform3D is used instead of the Target property.
public NodePath TargetNode { get; set; }
Property Value
TipBone
The name of the current tip bone, the last bone in the IK chain placed at the Target transform (or TargetNode if defined).
public StringName TipBone { get; set; }
Property Value
UseMagnet
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.
public bool UseMagnet { get; set; }
Property Value
Methods
GetParentSkeleton()
Returns the parent Skeleton3D Node that was present when SkeletonIK entered the SceneTree. Returns null if the parent node was not a Skeleton3D Node when SkeletonIK3D entered the SceneTree.
public Skeleton3D GetParentSkeleton()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsRunning()
Returns true
if SkeletonIK is applying IK effects on continues frames to the Skeleton3D bones. Returns false
if SkeletonIK is stopped or Start(bool) was used with the one_time
parameter set to true
.
public bool IsRunning()
Returns
Start(bool)
Starts applying IK effects on each frame to the Skeleton3D bones but will only take effect starting on the next frame. If oneTime
is true
, this will take effect immediately but also reset on the next frame.
public void Start(bool oneTime = false)
Parameters
oneTime
bool
Stop()
Stops applying IK effects on each frame to the Skeleton3D bones and also calls ClearBonesGlobalPoseOverride() to remove existing overrides on all bones.
public void Stop()