Index · Object → Node → Node3D → SkeletonModifier3D → SpringBoneSimulator3D

SpringBoneSimulator3D

A SkeletonModifier3D to apply inertial wavering to bone chains.

Class Description

This SkeletonModifier3D can be used to wiggle hair, cloth, and tails. This modifier behaves differently from PhysicalBoneSimulator3D as it attempts to return the original pose after modification.

If you setup set_root_bone() and set_end_bone(), it is treated as one bone chain. Note that it does not support a branched chain like Y-shaped chains.

When a bone chain is created, an array is generated from the bones that exist in between and listed in the joint list.

Several properties can be applied to each joint, such as set_joint_stiffness(), set_joint_drag(), and set_joint_gravity().

For simplicity, you can set values to all joints at the same time by using a Curve. If you want to specify detailed values individually, set set_individual_config() to true.

For physical simulation, SpringBoneSimulator3D can have children as self-standing collisions that are not related to PhysicsServer3D, see also SpringBoneCollision3D.

Warning: A scaled SpringBoneSimulator3D will likely not behave as expected. Make sure that the parent Skeleton3D and its bones are not scaled.

Note: Most methods in this class take an index parameter. This parameter specifies which setting list entry to return if the IK has multiple entries (e.g. settings/<index>/root_bone_name).

Properties

var external_force: Vector3 = Vector3(0, 0, 0)

The constant force that always affected bones. It is equal to the result when the parent Skeleton3D moves at this speed in the opposite direction.

This is useful for effects such as wind and anti-gravity.

var mutable_bone_axes: bool = true

If true, the solver retrieves the bone axis from the bone pose every frame.

If false, the solver retrieves the bone axis from the bone rest and caches it, which increases performance slightly, but position changes in the bone pose made before processing this SpringBoneSimulator3D are ignored.

var setting_count: int = 0

The number of settings.

Inherited from SkeletonModifier3D (2)
var active: bool = true
var influence: float = 1.0
Inherited from Node3D (17)
var position: Vector3 = Vector3(0, 0, 0)
var rotation: Vector3 = Vector3(0, 0, 0)
var rotation_order: EulerOrder = 2
var scale: Vector3 = Vector3(1, 1, 1)
var top_level: bool = false
var transform: Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
var visibility_parent: NodePath = NodePath("")
var visible: bool = true
Inherited from Node (14)
var owner: Node

Methods

func are_all_child_collisions_enabled(index: int) -> bool

Returns true if all child SpringBoneCollision3Ds are contained in the collision list at index in the settings.

func clear_collisions(index: int) -> void

Clears all collisions from the collision list at index in the settings when are_all_child_collisions_enabled() is false.

func clear_exclude_collisions(index: int) -> void

Clears all exclude collisions from the collision list at index in the settings when are_all_child_collisions_enabled() is true.

func clear_settings() -> void

Clears all settings.

func get_center_bone(index: int) -> int

Returns the center bone index of the bone chain.

func get_center_bone_name(index: int) -> String

Returns the center bone name of the bone chain.

func get_center_from(index: int) -> SpringBoneSimulator3D.CenterFrom

Returns what the center originates from in the bone chain.

func get_center_node(index: int) -> NodePath

Returns the center node path of the bone chain.

func get_collision_count(index: int) -> int

Returns the collision count of the bone chain's collision list when are_all_child_collisions_enabled() is false.

func get_collision_path(index: int, collision: int) -> NodePath

Returns the node path of the SpringBoneCollision3D at collision in the bone chain's collision list when are_all_child_collisions_enabled() is false.

func get_drag(index: int) -> float

Returns the drag force damping curve of the bone chain.

func get_drag_damping_curve(index: int) -> Curve

Returns the drag force damping curve of the bone chain.

func get_end_bone(index: int) -> int

Returns the end bone index of the bone chain.

func get_end_bone_direction(index: int) -> SkeletonModifier3D.BoneDirection

Returns the tail direction of the end bone of the bone chain when is_end_bone_extended() is true.

func get_end_bone_length(index: int) -> float

Returns the end bone tail length of the bone chain when is_end_bone_extended() is true.

func get_end_bone_name(index: int) -> String

Returns the end bone name of the bone chain.

func get_exclude_collision_count(index: int) -> int

Returns the exclude collision count of the bone chain's exclude collision list when are_all_child_collisions_enabled() is true.

func get_exclude_collision_path(index: int, collision: int) -> NodePath

Returns the node path of the SpringBoneCollision3D at collision in the bone chain's exclude collision list when are_all_child_collisions_enabled() is true.

func get_gravity(index: int) -> float

Returns the gravity amount of the bone chain.

func get_gravity_damping_curve(index: int) -> Curve

Returns the gravity amount damping curve of the bone chain.

func get_gravity_direction(index: int) -> Vector3

Returns the gravity direction of the bone chain.

func get_joint_bone(index: int, joint: int) -> int

Returns the bone index at joint in the bone chain's joint list.

func get_joint_bone_name(index: int, joint: int) -> String

Returns the bone name at joint in the bone chain's joint list.

func get_joint_count(index: int) -> int

Returns the joint count of the bone chain's joint list.

func get_joint_drag(index: int, joint: int) -> float

Returns the drag force at joint in the bone chain's joint list.

func get_joint_gravity(index: int, joint: int) -> float

Returns the gravity amount at joint in the bone chain's joint list.

func get_joint_gravity_direction(index: int, joint: int) -> Vector3

Returns the gravity direction at joint in the bone chain's joint list.

func get_joint_radius(index: int, joint: int) -> float

Returns the radius at joint in the bone chain's joint list.

func get_joint_rotation_axis(index: int, joint: int) -> SkeletonModifier3D.RotationAxis

Returns the rotation axis at joint in the bone chain's joint list.

func get_joint_rotation_axis_vector(index: int, joint: int) -> Vector3

Returns the rotation axis vector for the specified joint in the bone chain. This vector represents the axis around which the joint can rotate. It is determined based on the rotation axis set for the joint.

If get_joint_rotation_axis() is SkeletonModifier3D.ROTATION_AXIS_ALL, this method returns Vector3(0, 0, 0).

func get_joint_stiffness(index: int, joint: int) -> float

Returns the stiffness force at joint in the bone chain's joint list.

func get_radius(index: int) -> float

Returns the joint radius of the bone chain.

func get_radius_damping_curve(index: int) -> Curve

Returns the joint radius damping curve of the bone chain.

func get_root_bone(index: int) -> int

Returns the root bone index of the bone chain.

func get_root_bone_name(index: int) -> String

Returns the root bone name of the bone chain.

func get_rotation_axis(index: int) -> SkeletonModifier3D.RotationAxis

Returns the rotation axis of the bone chain.

func get_rotation_axis_vector(index: int) -> Vector3

Returns the rotation axis vector of the bone chain. This vector represents the axis around which the bone chain can rotate. It is determined based on the rotation axis set for the bone chain.

If get_rotation_axis() is SkeletonModifier3D.ROTATION_AXIS_ALL, this method returns Vector3(0, 0, 0).

func get_stiffness(index: int) -> float

Returns the stiffness force of the bone chain.

func get_stiffness_damping_curve(index: int) -> Curve

Returns the stiffness force damping curve of the bone chain.

func is_config_individual(index: int) -> bool

Returns true if the config can be edited individually for each joint.

func is_end_bone_extended(index: int) -> bool

Returns true if the end bone is extended to have a tail.

func reset() -> void

Resets a simulating state with respect to the current bone pose.

It is useful to prevent the simulation result getting violent. For example, calling this immediately after a call to AnimationPlayer.play() without a fading, or within the previous SkeletonModifier3D.modification_processed signal if it's condition changes significantly.

func set_center_bone(index: int, bone: int) -> void

Sets the center bone index of the bone chain.

func set_center_bone_name(index: int, bone_name: String) -> void

Sets the center bone name of the bone chain.

func set_center_from(index: int, center_from: SpringBoneSimulator3D.CenterFrom) -> void

Sets what the center originates from in the bone chain.

Bone movement is calculated based on the difference in relative distance between center and bone in the previous and next frames.

For example, if the parent Skeleton3D is used as the center, the bones are considered to have not moved if the Skeleton3D moves in the world.

In this case, only a change in the bone pose is considered to be a bone movement.

func set_center_node(index: int, node_path: NodePath) -> void

Sets the center node path of the bone chain.

func set_collision_count(index: int, count: int) -> void

Sets the number of collisions in the collision list at index in the settings when are_all_child_collisions_enabled() is false.

func set_collision_path(index: int, collision: int, node_path: NodePath) -> void

Sets the node path of the SpringBoneCollision3D at collision in the bone chain's collision list when are_all_child_collisions_enabled() is false.

func set_drag(index: int, drag: float) -> void

Sets the drag force of the bone chain. The greater the value, the more suppressed the wiggling.

The value is scaled by set_drag_damping_curve() and cached in each joint setting in the joint list.

func set_drag_damping_curve(index: int, curve: Curve) -> void

Sets the drag force damping curve of the bone chain.

func set_enable_all_child_collisions(index: int, enabled: bool) -> void

If enabled is true, all child SpringBoneCollision3Ds are colliding and set_exclude_collision_path() is enabled as an exclusion list at index in the settings.

If enabled is false, you need to manually register all valid collisions with set_collision_path().

func set_end_bone(index: int, bone: int) -> void

Sets the end bone index of the bone chain.

func set_end_bone_direction(index: int, bone_direction: SkeletonModifier3D.BoneDirection) -> void

Sets the end bone tail direction of the bone chain when is_end_bone_extended() is true.

func set_end_bone_length(index: int, length: float) -> void

Sets the end bone tail length of the bone chain when is_end_bone_extended() is true.

func set_end_bone_name(index: int, bone_name: String) -> void

Sets the end bone name of the bone chain.

Note: End bone must be the root bone or a child of the root bone. If they are the same, the tail must be extended by set_extend_end_bone() to jiggle the bone.

func set_exclude_collision_count(index: int, count: int) -> void

Sets the number of exclude collisions in the exclude collision list at index in the settings when are_all_child_collisions_enabled() is true.

func set_exclude_collision_path(index: int, collision: int, node_path: NodePath) -> void

Sets the node path of the SpringBoneCollision3D at collision in the bone chain's exclude collision list when are_all_child_collisions_enabled() is true.

func set_extend_end_bone(index: int, enabled: bool) -> void

If enabled is true, the end bone is extended to have a tail.

The extended tail config is allocated to the last element in the joint list. In other words, if you set enabled to false, the config of the last element in the joint list has no effect in the simulated result.

func set_gravity(index: int, gravity: float) -> void

Sets the gravity amount of the bone chain. This value is not an acceleration, but a constant velocity of movement in set_gravity_direction().

If gravity is not 0, the modified pose will not return to the original pose since it is always affected by gravity.

The value is scaled by set_gravity_damping_curve() and cached in each joint setting in the joint list.

func set_gravity_damping_curve(index: int, curve: Curve) -> void

Sets the gravity amount damping curve of the bone chain.

func set_gravity_direction(index: int, gravity_direction: Vector3) -> void

Sets the gravity direction of the bone chain. This value is internally normalized and then multiplied by set_gravity().

The value is cached in each joint setting in the joint list.

func set_individual_config(index: int, enabled: bool) -> void

If enabled is true, the config can be edited individually for each joint.

func set_joint_drag(index: int, joint: int, drag: float) -> void

Sets the drag force at joint in the bone chain's joint list when is_config_individual() is true.

func set_joint_gravity(index: int, joint: int, gravity: float) -> void

Sets the gravity amount at joint in the bone chain's joint list when is_config_individual() is true.

func set_joint_gravity_direction(index: int, joint: int, gravity_direction: Vector3) -> void

Sets the gravity direction at joint in the bone chain's joint list when is_config_individual() is true.

func set_joint_radius(index: int, joint: int, radius: float) -> void

Sets the joint radius at joint in the bone chain's joint list when is_config_individual() is true.

func set_joint_rotation_axis(index: int, joint: int, axis: SkeletonModifier3D.RotationAxis) -> void

Sets the rotation axis at joint in the bone chain's joint list when is_config_individual() is true.

The axes are based on the reference pose's space, if axis is SkeletonModifier3D.ROTATION_AXIS_CUSTOM, you can specify any axis.

In here, the reference pose is the bone pose immediately before the simulation.

Note: The rotation axis and the forward vector shouldn't be colinear to avoid unintended rotation since SpringBoneSimulator3D does not factor in twisting forces.

func set_joint_rotation_axis_vector(index: int, joint: int, vector: Vector3) -> void

Sets the rotation axis vector for the specified joint in the bone chain.

This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.

If the vector length is 0, it is considered synonymous with SkeletonModifier3D.ROTATION_AXIS_ALL.

func set_joint_stiffness(index: int, joint: int, stiffness: float) -> void

Sets the stiffness force at joint in the bone chain's joint list when is_config_individual() is true.

func set_radius(index: int, radius: float) -> void

Sets the joint radius of the bone chain. It is used to move and slide with the SpringBoneCollision3D in the collision list.

The value is scaled by set_radius_damping_curve() and cached in each joint setting in the joint list.

func set_radius_damping_curve(index: int, curve: Curve) -> void

Sets the joint radius damping curve of the bone chain.

func set_root_bone(index: int, bone: int) -> void

Sets the root bone index of the bone chain.

func set_root_bone_name(index: int, bone_name: String) -> void

Sets the root bone name of the bone chain.

func set_rotation_axis(index: int, axis: SkeletonModifier3D.RotationAxis) -> void

Sets the rotation axis of the bone chain. If set to a specific axis, it acts like a hinge joint. The value is cached in each joint setting in the joint list.

The axes are based on the reference pose's space, if axis is SkeletonModifier3D.ROTATION_AXIS_CUSTOM, you can specify any axis.

In here, the reference pose is the bone pose immediately before the simulation.

Note: The rotation axis vector and the forward vector shouldn't be colinear to avoid unintended rotation since SpringBoneSimulator3D does not factor in twisting forces.

func set_rotation_axis_vector(index: int, vector: Vector3) -> void

Sets the rotation axis vector of the bone chain. The value is cached in each joint setting in the joint list.

This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.

If the vector length is 0, it is considered synonymous with SkeletonModifier3D.ROTATION_AXIS_ALL.

func set_stiffness(index: int, stiffness: float) -> void

Sets the stiffness force of the bone chain. The greater the value, the faster it recovers to its initial pose.

If stiffness is 0, the modified pose will not return to the original pose.

The value is scaled by set_stiffness_damping_curve() and cached in each joint setting in the joint list.

func set_stiffness_damping_curve(index: int, curve: Curve) -> void

Sets the stiffness force damping curve of the bone chain.

Inherited from SkeletonModifier3D (5)
func _process_modification() -> void
func _skeleton_changed(old_skeleton: Skeleton3D, new_skeleton: Skeleton3D) -> void
func _validate_bone_names() -> void
Inherited from Node3D (37)
func add_gizmo(gizmo: Node3DGizmo) -> void
func clear_gizmos() -> void
func force_update_transform() -> void
func get_gizmos() -> Node3DGizmo[]
func global_rotate(axis: Vector3, angle: float) -> void
func global_scale(scale: Vector3) -> void
func global_translate(offset: Vector3) -> void
func hide() -> void
func look_at(target: Vector3, up: Vector3 = Vector3(0, 1, 0), use_model_front: bool = false) -> void
func look_at_from_position(position: Vector3, target: Vector3, up: Vector3 = Vector3(0, 1, 0), use_model_front: bool = false) -> void
func orthonormalize() -> void
func rotate(axis: Vector3, angle: float) -> void
func rotate_object_local(axis: Vector3, angle: float) -> void
func rotate_x(angle: float) -> void
func rotate_y(angle: float) -> void
func rotate_z(angle: float) -> void
func scale_object_local(scale: Vector3) -> void
func set_disable_scale(disable: bool) -> void
func set_identity() -> void
func set_notify_local_transform(enable: bool) -> void
func set_notify_transform(enable: bool) -> void
func set_subgizmo_selection(gizmo: Node3DGizmo, id: int, transform: Transform3D) -> void
func show() -> void
func to_global(local_point: Vector3) -> Vector3
func to_local(global_point: Vector3) -> Vector3
func translate(offset: Vector3) -> void
func translate_object_local(offset: Vector3) -> void
func update_gizmos() -> void
Inherited from Node (106)
func _enter_tree() -> void
func _exit_tree() -> void
func _input(event: InputEvent) -> void
func _physics_process(delta: float) -> void
func _process(delta: float) -> void
func _ready() -> void
func _shortcut_input(event: InputEvent) -> void
func _unhandled_input(event: InputEvent) -> void
func _unhandled_key_input(event: InputEvent) -> void
func add_child(node: Node, force_readable_name: bool = false, internal: Node.InternalMode = 0) -> void
func add_sibling(sibling: Node, force_readable_name: bool = false) -> void
func add_to_group(group: StringName, persistent: bool = false) -> void
func atr(message: String, context: StringName = "") -> String
func atr_n(message: String, plural_message: StringName, n: int, context: StringName = "") -> String
func can_process() -> bool
func duplicate(flags: int = 15) -> Node
func find_child(pattern: String, recursive: bool = true, owned: bool = true) -> Node
func find_children(pattern: String, type: String = "", recursive: bool = true, owned: bool = true) -> Node[]
func find_parent(pattern: String) -> Node
func get_child(idx: int, include_internal: bool = false) -> Node
func get_child_count(include_internal: bool = false) -> int
func get_children(include_internal: bool = false) -> Node[]
func get_groups() -> StringName[]
func get_index(include_internal: bool = false) -> int
func get_node(path: NodePath) -> Node
func get_orphan_node_ids() -> int[]
func get_parent() -> Node
func get_path() -> NodePath
func get_path_to(node: Node, use_unique_path: bool = false) -> NodePath
func get_window() -> Window
func has_node(path: NodePath) -> bool
func is_ancestor_of(node: Node) -> bool
func is_greater_than(node: Node) -> bool
func is_in_group(group: StringName) -> bool
func move_child(child_node: Node, to_index: int) -> void
func notify_deferred_thread_group(what: int) -> void
func notify_thread_safe(what: int) -> void
func print_orphan_nodes() -> void
func print_tree() -> void
func print_tree_pretty() -> void
func propagate_call(method: StringName, args: Array = [], parent_first: bool = false) -> void
func propagate_notification(what: int) -> void
func queue_free() -> void
func remove_child(node: Node) -> void
func remove_from_group(group: StringName) -> void
func reparent(new_parent: Node, keep_global_transform: bool = true) -> void
func replace_by(node: Node, keep_groups: bool = false) -> void
func request_ready() -> void
func rpc(method: StringName) -> Error
func rpc_config(method: StringName, config: Variant) -> void
func rpc_id(peer_id: int, method: StringName) -> Error
func set_deferred_thread_group(property: StringName, value: Variant) -> void
func set_display_folded(fold: bool) -> void
func set_editable_instance(node: Node, is_editable: bool) -> void
func set_multiplayer_authority(id: int, recursive: bool = true) -> void
func set_physics_process(enable: bool) -> void
func set_physics_process_internal(enable: bool) -> void
func set_process(enable: bool) -> void
func set_process_input(enable: bool) -> void
func set_process_internal(enable: bool) -> void
func set_process_shortcut_input(enable: bool) -> void
func set_process_unhandled_input(enable: bool) -> void
func set_scene_instance_load_placeholder(load_placeholder: bool) -> void
func set_thread_safe(property: StringName, value: Variant) -> void
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from SkeletonModifier3D (1)
Inherited from Node3D (1)
Inherited from Node (11)
signal child_entered_tree(node: Node)
signal child_exiting_tree(node: Node)
signal ready()
signal renamed()
signal replacing_by(node: Node)
signal tree_entered()
signal tree_exited()
signal tree_exiting()
Inherited from Object (2)

Enums & Constants

enum CenterFrom
CENTER_FROM_WORLD_ORIGIN = 0

The world origin is defined as center.

CENTER_FROM_NODE = 1

The Node3D specified by set_center_node() is defined as center.

If Node3D is not found, the parent Skeleton3D is treated as center.

CENTER_FROM_BONE = 2

The bone pose origin of the parent Skeleton3D specified by set_center_bone() is defined as center.

If Node3D is not found, the parent Skeleton3D is treated as center.