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.
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 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.
Tutorials
Methods
( ) const | |
( ) | |
void | |
void | stop ( ) |
- float interpolation
Default |
|
Setter | set_interpolation(value) |
Getter | get_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 .
- Vector3 magnet
Default |
|
Setter | set_magnet_position(value) |
Getter | get_magnet_position() |
Secondary target position (first is property or target_node) 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.
- max_iterations
Number of iteration loops used by the IK solver to produce more accurate (and elegant) bone chain results.
- float min_distance
Default |
|
Setter | set_min_distance(value) |
Getter | get_min_distance() |
The minimum distance between bone and goal target. If the distance is below this value, the IK solver stops further iterations.
- override_tip_basis
Default |
|
Setter | set_override_tip_basis(value) |
Getter | is_override_tip_basis() |
If true
overwrites the rotation of the tip bone with the rotation of the target (or if defined).
- String root_bone
| |
Setter | set_root_bone(value) |
Getter | get_root_bone() |
The name of the current root bone, the first bone in the IK chain.
First target of the IK chain where the tip bone is placed and, if is true
, how the tip bone is rotated. If a target_node path is available the nodes transform is used instead and this property is ignored.
- target_node
Default |
|
Setter | set_target_node(value) |
Getter | get_target_node() |
Target node NodePath for the IK chain. If available, the node’s current is used instead of the target property.
- tip_bone
Default |
|
Setter | set_tip_bone(value) |
Getter | get_tip_bone() |
The name of the current tip bone, the last bone in the IK chain placed at the target transform (or if defined).
- bool use_magnet
Default |
|
Setter | set_use_magnet(value) |
Getter | is_using_magnet() |
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.
Method Descriptions
- Skeleton get_parent_skeleton ( ) const
Returns the parent Node that was present when SkeletonIK entered the SceneTree. Returns null if the parent node was not a Node when SkeletonIK entered the SceneTree.
- is_running ( )
Returns true
if SkeletonIK is applying IK effects on continues frames to the Skeleton bones. Returns false
if SkeletonIK is stopped or was used with the one_time
parameter set to true
.
- void start ( bool one_time=false )
Starts applying IK effects on each frame to the bones but will only take effect starting on the next frame. If one_time
is , this will take effect immediately but also reset on the next frame.