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
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
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
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
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
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
ParentCollisionIgnore
NodePath to a CollisionObject3D this SoftBody3D should avoid clipping.
public NodePath ParentCollisionIgnore { get; set; }
Property Value
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
RayPickable
If true
, the SoftBody3D will respond to RayCast3Ds.
public bool RayPickable { get; set; }
Property Value
SimulationPrecision
Increasing this value will improve the resulting simulation, but can affect performance. Use with care.
public int SimulationPrecision { get; set; }
Property Value
TotalMass
The SoftBody3D's mass.
public float TotalMass { get; set; }
Property Value
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
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
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
GetPhysicsRid()
Returns the internal Rid used by the PhysicsServer3D for this body.
public Rid GetPhysicsRid()
Returns
GetPointTransform(int)
Returns local translation of a vertex in the surface array.
public Vector3 GetPointTransform(int pointIndex)
Parameters
pointIndex
int
Returns
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsPointPinned(int)
Returns true
if vertex is set to pinned.
public bool IsPointPinned(int pointIndex)
Parameters
pointIndex
int
Returns
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
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
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)