Table of Contents

Class SoftBody3D

Namespace
Godot
Assembly
GodotSharp.dll

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

Note: There are many known bugs in SoftBody3D. Therefore, it's not recommended to use them for things that can affect gameplay (such as trampolines).

public class SoftBody3D : MeshInstance3D, IDisposable
Inheritance
SoftBody3D
Implements
Inherited Members

Constructors

SoftBody3D()

public SoftBody3D()

Properties

CollisionLayer

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

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.

public uint CollisionLayer { get; set; }

Property Value

uint

CollisionMask

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

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.

public uint CollisionMask { get; set; }

Property Value

uint

DampingCoefficient

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

public float DampingCoefficient { get; set; }

Property Value

float

DisableMode

Defines the behavior in physics when ProcessMode is set to Disabled. See SoftBody3D.DisableModeEnum for more details about the different modes.

public SoftBody3D.DisableModeEnum DisableMode { get; set; }

Property Value

SoftBody3D.DisableModeEnum

DragCoefficient

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.

public float DragCoefficient { get; set; }

Property Value

float

LinearStiffness

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).

public float LinearStiffness { get; set; }

Property Value

float

ParentCollisionIgnore

NodePath to a CollisionObject3D this SoftBody3D should avoid clipping.

public NodePath ParentCollisionIgnore { get; set; }

Property Value

NodePath

PressureCoefficient

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

public float PressureCoefficient { get; set; }

Property Value

float

RayPickable

If true, the SoftBody3D will respond to RayCast3Ds.

public bool RayPickable { get; set; }

Property Value

bool

SimulationPrecision

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

public int SimulationPrecision { get; set; }

Property Value

int

TotalMass

The SoftBody3D's mass.

public float TotalMass { get; set; }

Property Value

float

Methods

AddCollisionExceptionWith(Node)

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

public void AddCollisionExceptionWith(Node body)

Parameters

body Node

GetCollisionExceptions()

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

public Array<PhysicsBody3D> GetCollisionExceptions()

Returns

Array<PhysicsBody3D>

GetCollisionLayerValue(int)

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

public bool GetCollisionLayerValue(int layerNumber)

Parameters

layerNumber int

Returns

bool

GetCollisionMaskValue(int)

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

public bool GetCollisionMaskValue(int layerNumber)

Parameters

layerNumber int

Returns

bool

GetPhysicsRid()

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

public Rid GetPhysicsRid()

Returns

Rid

GetPointTransform(int)

Returns local translation of a vertex in the surface array.

public Vector3 GetPointTransform(int pointIndex)

Parameters

pointIndex int

Returns

Vector3

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_name

Name of the method to check for.

Returns

bool

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_name

Name of the signal to check for.

Returns

bool

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_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsPointPinned(int)

Returns true if vertex is set to pinned.

public bool IsPointPinned(int pointIndex)

Parameters

pointIndex int

Returns

bool

RemoveCollisionExceptionWith(Node)

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

public void RemoveCollisionExceptionWith(Node body)

Parameters

body Node

SetCollisionLayerValue(int, bool)

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

public void SetCollisionLayerValue(int layerNumber, bool value)

Parameters

layerNumber int
value bool

SetCollisionMaskValue(int, bool)

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

public void SetCollisionMaskValue(int layerNumber, bool value)

Parameters

layerNumber int
value bool

SetPointPinned(int, bool, NodePath)

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

public void SetPointPinned(int pointIndex, bool pinned, NodePath attachmentPath = null)

Parameters

pointIndex int
pinned bool
attachmentPath NodePath