Index · Object → Node → Node3D → VisualInstance3D → GeometryInstance3D → MeshInstance3D → SoftBody3D

SoftBody3D

A deformable 3D physics mesh.

Class Description

A deformable 3D physics mesh. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials.

Additionally, SoftBody3D is subject to wind forces defined in Area3D (see Area3D.wind_source_path, Area3D.wind_force_magnitude, and Area3D.wind_attenuation_factor).

Note: It's recommended to use Jolt Physics when using SoftBody3D instead of the default GodotPhysics3D, as Jolt Physics' soft body implementation is faster and more reliable. You can switch the physics engine using the ProjectSettings.physics/3d/physics_engine project setting.

Properties

var collision_layer: int = 1

The physics layers this SoftBody3D is in. Collision objects can exist in one or more of 32 different layers. See also collision_mask.

Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information.

var collision_mask: int = 1

The physics layers this SoftBody3D scans. Collision objects can scan one or more of 32 different layers. See also collision_layer.

Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information.

var damping_coefficient: float = 0.01

The body's damping coefficient. Higher values will slow down the body more noticeably when forces are applied.

var disable_mode: SoftBody3D.DisableMode = 0

Defines the behavior in physics when Node.process_mode is set to Node.PROCESS_MODE_DISABLED.

var drag_coefficient: float = 0.0

The body's drag coefficient. Higher values increase this body's air resistance.

Note: This value is currently unused by Godot's default physics implementation.

var linear_stiffness: float = 0.5

Higher values will result in a stiffer body, while lower values will increase the body's ability to bend. The value can be between 0.0 and 1.0 (inclusive).

var parent_collision_ignore: NodePath = NodePath("")

NodePath to a CollisionObject3D this SoftBody3D should avoid clipping.

var pressure_coefficient: float = 0.0

The pressure coefficient of this soft body. Simulate pressure build-up from inside this body. Higher values increase the strength of this effect.

var ray_pickable: bool = true

If true, the SoftBody3D will respond to RayCast3Ds.

var shrinking_factor: float = 0.0

Scales the rest lengths of SoftBody3D's edge constraints. Positive values shrink the mesh, while negative values expand it. For example, a value of 0.1 shortens the edges of the mesh by 10%, while -0.1 expands the edges by 10%.

Note: shrinking_factor is best used on surface meshes with pinned points.

var simulation_precision: int = 5

Increasing this value will improve the resulting simulation, but can affect performance. Use with care.

var total_mass: float = 1.0

The SoftBody3D's mass.

Inherited from MeshInstance3D (3)
var mesh: Mesh
var skeleton: NodePath = NodePath("")
var skin: Skin
Inherited from GeometryInstance3D (16)
var custom_aabb: AABB = AABB(0, 0, 0, 0, 0, 0)
var lod_bias: float = 1.0
var transparency: float = 0.0
Inherited from VisualInstance3D (3)
var layers: int = 1
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 add_collision_exception_with(body: Node) -> void

Adds a body to the list of bodies that this body can't collide with.

func apply_central_force(force: Vector3) -> void

Distributes and applies a force to all points. A force is time dependent and meant to be applied every physics update.

func apply_central_impulse(impulse: Vector3) -> void

Distributes and applies an impulse to all points.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

func apply_force(point_index: int, force: Vector3) -> void

Applies a force to a point. A force is time dependent and meant to be applied every physics update.

func apply_impulse(point_index: int, impulse: Vector3) -> void

Applies an impulse to a point.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

func get_collision_exceptions() -> PhysicsBody3D[]

Returns an array of nodes that were added as collision exceptions for this body.

func get_collision_layer_value(layer_number: int) -> bool

Returns whether or not the specified layer of the collision_layer is enabled, given a layer_number between 1 and 32.

func get_collision_mask_value(layer_number: int) -> bool

Returns whether or not the specified layer of the collision_mask is enabled, given a layer_number between 1 and 32.

func get_physics_rid() -> RID

Returns the internal RID used by the PhysicsServer3D for this body.

func get_point_transform(point_index: int) -> Vector3

Returns local translation of a vertex in the surface array.

func is_point_pinned(point_index: int) -> bool

Returns true if vertex is set to pinned.

func remove_collision_exception_with(body: Node) -> void

Removes a body from the list of bodies that this body can't collide with.

func set_collision_layer_value(layer_number: int, value: bool) -> void

Based on value, enables or disables the specified layer in the collision_layer, given a layer_number between 1 and 32.

func set_collision_mask_value(layer_number: int, value: bool) -> void

Based on value, enables or disables the specified layer in the collision_mask, given a layer_number between 1 and 32.

func set_point_pinned(point_index: int, pinned: bool, attachment_path: NodePath = NodePath(""), insert_at: int = -1) -> void

Sets the pinned state of a surface vertex. When set to true, the optional attachment_path can define a Node3D the pinned vertex will be attached to.

Inherited from MeshInstance3D (15)
func create_convex_collision(clean: bool = true, simplify: bool = false) -> void
func create_debug_tangents() -> void
func get_active_material(surface: int) -> Material
func get_blend_shape_value(blend_shape_idx: int) -> float
func set_blend_shape_value(blend_shape_idx: int, value: float) -> void
func set_surface_override_material(surface: int, material: Material) -> void
Inherited from GeometryInstance3D (2)
Inherited from VisualInstance3D (7)
func _get_aabb() -> AABB
func get_aabb() -> AABB
func get_base() -> RID
func get_instance() -> RID
func get_layer_mask_value(layer_number: int) -> bool
func set_base(base: RID) -> void
func set_layer_mask_value(layer_number: int, value: bool) -> 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 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 DisableMode
DISABLE_MODE_REMOVE = 0

When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, remove from the physics simulation to stop all physics interactions with this SoftBody3D.

Automatically re-added to the physics simulation when the Node is processed again.

DISABLE_MODE_KEEP_ACTIVE = 1

When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, do not affect the physics simulation.