SkeletonIK3D
A node used to rotate all bones of a Skeleton3D
bone chain a way that places the end bone at a desired 3D position.
class SkeletonIK3D
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 Skeleton3D
bones_global_pose_override
property for all affected bones in the chain. If fully applied, this overwrites any bone transform from Animation
s or bone custom poses set by users. The applied amount can be controlled with the interpolation
property.
Deprecated. This class is deprecated, and might be removed in a future release.
Superclasses
class Node
Base class for all scene objects.
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 interpolation: Double
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 of0.0
will visually disable the SkeletonIK. A value at or below0.01
also callsclearBonesGlobalPoseOverride
.var magnet: Vector3
Secondary target position (first is
target
property ortargetNode
) 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.var maxIterations: Int32
Number of iteration loops used by the IK solver to produce more accurate (and elegant) bone chain results.
var minDistance: Double
The minimum distance between bone and goal target. If the distance is below this value, the IK solver stops further iterations.
var overrideTipBasis: Bool
If
true
overwrites the rotation of the tip bone with the rotation of thetarget
(ortargetNode
if defined).var rootBone: StringName
The name of the current root bone, the first bone in the IK chain.
var target: Transform3D
First target of the IK chain where the tip bone is placed and, if
overrideTipBasis
istrue
, how the tip bone is rotated. If atargetNode
path is available the nodes transform is used instead and this property is ignored.var targetNode: NodePath
Target node
NodePath
for the IK chain. If available, the node’s currentTransform3D
is used instead of thetarget
property.var tipBone: StringName
The name of the current tip bone, the last bone in the IK chain placed at the
target
transform (ortargetNode
if defined).var useMagnet: Bool
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.func getParentSkeleton(
) -> Skeleton3D? Returns the parent
Skeleton3D
Node that was present when SkeletonIK entered theSceneTree
. Returns null if the parent node was not aSkeleton3D
Node when SkeletonIK3D entered theSceneTree
.func isRunning(
) -> Bool Returns
true
if SkeletonIK is applying IK effects on continues frames to theSkeleton3D
bones. Returnsfalse
if SkeletonIK is stopped orstart(oneTime:)
was used with theone_time
parameter set totrue
.func start(oneTime: Bool
) Starts applying IK effects on each frame to the
Skeleton3D
bones but will only take effect starting on the next frame. IfoneTime
istrue
, this will take effect immediately but also reset on the next frame.func stop(
) Stops applying IK effects on each frame to the
Skeleton3D
bones and also callsclearBonesGlobalPoseOverride
to remove existing overrides on all bones.