reckfellENGINE

SoftBody3D

A deformable physics body based on a triangle mesh.

On this page
class SoftBody3DReckfellSharpInherits MeshInstance3D

SoftBody3D simulates mesh points and constraints. It uses Mesh and pinned vertices rather than ordinary child CollisionShape3D entities. Current code creates a mutable copy of the first surface; check topology and indices after import.

PointCount describes first-surface vertex count, not independent proof of a ready physics space. Access points after adding the body to a world. Pinning, Layer/Mask and ParentCollisionIgnore serve different purposes. The example is checked with ReckfellPhysics3D and Jolt Physics; arbitrary imported cloth/contact setups need separate tests.

Working example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

SoftBody3DConstructor
# SoftBody3D
C#
public SoftBody3D();

Properties13

CollisionLayerProperty
# CollisionLayer
C#
public uint CollisionLayer { get; set; }

The physics layers this SoftBody3D is in. Collision objects can exist in one or more of 32 different layers. See also SoftBody3D.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.

CollisionMaskProperty
# CollisionMask
C#
public uint CollisionMask { get; set; }

The physics layers this SoftBody3D scans. Collision objects can scan one or more of 32 different layers. See also SoftBody3D.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.

DampingCoefficientProperty
# DampingCoefficient
C#
public float DampingCoefficient { get; set; }

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

DisableModeProperty
# DisableMode
C#
public SoftBody3D.DisableModeEnum DisableMode { get; set; }

Defines the behavior in physics when Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled.

DragCoefficientProperty
# DragCoefficient
C#
public float DragCoefficient { get; set; }

The body's drag coefficient. Higher values increase this body's air resistance. Note: This value is currently unused by Reckfell's default physics implementation.

LinearStiffnessProperty
# LinearStiffness
C#
public float LinearStiffness { get; set; }

A deformation-resistance coefficient. The same value does not guarantee equal results across topology, timestep or backend. Begin with a simple mesh and test deformation/cost.

ParentCollisionIgnoreProperty
# ParentCollisionIgnore
C#
public EntityPath ParentCollisionIgnore { get; set; }

A path used to exclude the corresponding parent physics object from collisions. It does not pin cloth to a skeleton or generally replace Layer/Mask.

PointCountProperty
# PointCount
C#
public int PointCount { get; }

The current Mesh first-surface vertex count. This alone does not prove an arbitrary body has entered a physics space or started updating points.

PressureCoefficientProperty
# PressureCoefficient
C#
public float PressureCoefficient { get; set; }

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

RayPickableProperty
# RayPickable
C#
public bool RayPickable { get; set; }

If true, the SoftBody3D will respond to RayCast3Ds.

ShrinkingFactorProperty
# ShrinkingFactor
C#
public float ShrinkingFactor { get; set; }

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: SoftBody3D.ShrinkingFactor is best used on surface meshes with pinned points.

SimulationPrecisionProperty
# SimulationPrecision
C#
public int SimulationPrecision { get; set; }

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

TotalMassProperty
# TotalMass
C#
public float TotalMass { get; set; }

The SoftBody3D's mass.

Methods41

AddCollisionExceptionWithvoid
# AddCollisionExceptionWith
C#
public void AddCollisionExceptionWith(Entity body);

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

Parameters
NameTypeDefault
bodyEntity—
ApplyCentralForcevoid
# ApplyCentralForce
C#
public void ApplyCentralForce(Vector3 force);

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

Parameters
NameTypeDefault
forceVector3—
ApplyCentralImpulsevoid
# ApplyCentralImpulse
C#
public void ApplyCentralImpulse(Vector3 impulse);

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

Parameters
NameTypeDefault
impulseVector3—
ApplyForcevoid
# ApplyForce
C#
public void ApplyForce(int pointIndex, Vector3 force);

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

Parameters
NameTypeDefault
pointIndexint—
forceVector3—
ApplyImpulsevoid
# ApplyImpulse
C#
public void ApplyImpulse(int pointIndex, Vector3 impulse);

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

Parameters
NameTypeDefault
pointIndexint—
impulseVector3—
GetCollisionExceptionsReckfell.Collections.Array<PhysicsBody3D>
# GetCollisionExceptions
C#
public Reckfell.Collections.Array<PhysicsBody3D> GetCollisionExceptions();

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

Returns Reckfell.Collections.Array<PhysicsBody3D>
GetCollisionLayeruint
# GetCollisionLayer
C#
public uint GetCollisionLayer();
Returns uint
GetCollisionLayerValuebool
# GetCollisionLayerValue
C#
public bool GetCollisionLayerValue(int layerNumber);

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

Parameters
NameTypeDefault
layerNumberint—
Returns bool
GetCollisionMaskuint
# GetCollisionMask
C#
public uint GetCollisionMask();
Returns uint
GetCollisionMaskValuebool
# GetCollisionMaskValue
C#
public bool GetCollisionMaskValue(int layerNumber);

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

Parameters
NameTypeDefault
layerNumberint—
Returns bool
GetDampingCoefficientfloat
# GetDampingCoefficient
C#
public float GetDampingCoefficient();
Returns float
GetDisableModeSoftBody3D.DisableModeEnum
# GetDisableMode
C#
public SoftBody3D.DisableModeEnum GetDisableMode();
Returns SoftBody3D.DisableModeEnum
GetDragCoefficientfloat
# GetDragCoefficient
C#
public float GetDragCoefficient();
Returns float
GetLinearStiffnessfloat
# GetLinearStiffness
C#
public float GetLinearStiffness();
Returns float
GetParentCollisionIgnoreEntityPath
# GetParentCollisionIgnore
C#
public EntityPath GetParentCollisionIgnore();
Returns EntityPath
GetPhysicsRidRid
# GetPhysicsRid
C#
public Rid GetPhysicsRid();

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

Returns Rid
GetPointCountint
# GetPointCount
C#
public int GetPointCount();
Returns int
GetPointTransformVector3
# GetPointTransform
C#
public Vector3 GetPointTransform(int pointIndex);

Returns a physics point world position despite Transform in its name. Check the index and body membership in a physics world; this is not an ordinary entity transform.

Parameters
NameTypeDefault
pointIndexint—
Returns Vector3
GetPressureCoefficientfloat
# GetPressureCoefficient
C#
public float GetPressureCoefficient();
Returns float
GetShrinkingFactorfloat
# GetShrinkingFactor
C#
public float GetShrinkingFactor();
Returns float
GetSimulationPrecisionint
# GetSimulationPrecision
C#
public int GetSimulationPrecision();
Returns int
GetTotalMassfloat
# GetTotalMass
C#
public float GetTotalMass();
Returns float
IsPointPinnedbool
# IsPointPinned
C#
public bool IsPointPinned(int pointIndex);

Returns true if vertex is set to pinned.

Parameters
NameTypeDefault
pointIndexint—
Returns bool
IsRayPickablebool
# IsRayPickable
C#
public bool IsRayPickable();
Returns bool
RemoveCollisionExceptionWithvoid
# RemoveCollisionExceptionWith
C#
public void RemoveCollisionExceptionWith(Entity body);

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

Parameters
NameTypeDefault
bodyEntity—
SetCollisionLayervoid
# SetCollisionLayer
C#
public void SetCollisionLayer(uint collisionLayer);
Parameters
NameTypeDefault
collisionLayeruint—
SetCollisionLayerValuevoid
# SetCollisionLayerValue
C#
public void SetCollisionLayerValue(int layerNumber, bool value);

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

Parameters
NameTypeDefault
layerNumberint—
valuebool—
SetCollisionMaskvoid
# SetCollisionMask
C#
public void SetCollisionMask(uint collisionMask);
Parameters
NameTypeDefault
collisionMaskuint—
SetCollisionMaskValuevoid
# SetCollisionMaskValue
C#
public void SetCollisionMaskValue(int layerNumber, bool value);

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

Parameters
NameTypeDefault
layerNumberint—
valuebool—
SetDampingCoefficientvoid
# SetDampingCoefficient
C#
public void SetDampingCoefficient(float dampingCoefficient);
Parameters
NameTypeDefault
dampingCoefficientfloat—
SetDisableModevoid
# SetDisableMode
C#
public void SetDisableMode(SoftBody3D.DisableModeEnum mode);
Parameters
NameTypeDefault
modeSoftBody3D.DisableModeEnum—
SetDragCoefficientvoid
# SetDragCoefficient
C#
public void SetDragCoefficient(float dragCoefficient);
Parameters
NameTypeDefault
dragCoefficientfloat—
SetLinearStiffnessvoid
# SetLinearStiffness
C#
public void SetLinearStiffness(float linearStiffness);
Parameters
NameTypeDefault
linearStiffnessfloat—
SetParentCollisionIgnorevoid
# SetParentCollisionIgnore
C#
public void SetParentCollisionIgnore(EntityPath parentCollisionIgnore);
Parameters
NameTypeDefault
parentCollisionIgnoreEntityPath—
SetPointPinned2 overloads
# SetPointPinned · 1/2
C#
public void SetPointPinned(int pointIndex, bool pinned, EntityPath attachmentPath);

Pins/unpins a point by index; attachmentPath optionally identifies an attachment entity. Validate range and mesh topology. Indices can change after reimport/optimization; pinning does not replace collision filters.

Parameters
NameTypeDefault
pointIndexint—
pinnedbool—
attachmentPathEntityPath—
# SetPointPinned · 2/2
C#
public void SetPointPinned(int pointIndex, bool pinned, EntityPath attachmentPath = null, int insertAt = -1);

Pins/unpins a point by index; attachmentPath optionally identifies an attachment entity. Validate range and mesh topology. Indices can change after reimport/optimization; pinning does not replace collision filters.

Parameters
NameTypeDefault
pointIndexint—
pinnedbool—
attachmentPathEntityPathnull
insertAtint-1
SetPressureCoefficientvoid
# SetPressureCoefficient
C#
public void SetPressureCoefficient(float pressureCoefficient);
Parameters
NameTypeDefault
pressureCoefficientfloat—
SetRayPickablevoid
# SetRayPickable
C#
public void SetRayPickable(bool rayPickable);
Parameters
NameTypeDefault
rayPickablebool—
SetShrinkingFactorvoid
# SetShrinkingFactor
C#
public void SetShrinkingFactor(float shrinkingFactor);
Parameters
NameTypeDefault
shrinkingFactorfloat—
SetSimulationPrecisionvoid
# SetSimulationPrecision
C#
public void SetSimulationPrecision(int simulationPrecision);
Parameters
NameTypeDefault
simulationPrecisionint—
SetTotalMassvoid
# SetTotalMass
C#
public void SetTotalMass(float mass);
Parameters
NameTypeDefault
massfloat—

SoftBody3D.DisableModeEnum

ValueDescription
KeepActive = 1

When Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled, do not affect the physics simulation.

Remove = 0

When Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled, remove from the physics simulation to stop all physics interactions with this SoftBody3D. Automatically re-added to the physics simulation when the Entity is processed again.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.