SoftBody3D
A deformable physics body based on a triangle mesh.
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.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
SoftBody3DConstructor
public SoftBody3D();Properties13
CollisionLayerProperty
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
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
public float DampingCoefficient { get; set; }The body's damping coefficient. Higher values will slow down the body more noticeably when forces are applied.
DisableModeProperty
public SoftBody3D.DisableModeEnum DisableMode { get; set; }Defines the behavior in physics when Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled.
DragCoefficientProperty
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
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
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
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
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
public bool RayPickable { get; set; }If true, the SoftBody3D will respond to RayCast3Ds.
ShrinkingFactorProperty
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
public int SimulationPrecision { get; set; }Increasing this value will improve the resulting simulation, but can affect performance. Use with care.
TotalMassProperty
public float TotalMass { get; set; }The SoftBody3D's mass.
Methods41
AddCollisionExceptionWithvoid
public void AddCollisionExceptionWith(Entity body);Adds a body to the list of bodies that this body can't collide with.
| Name | Type | Default |
|---|---|---|
body | Entity | — |
ApplyCentralForcevoid
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.
| Name | Type | Default |
|---|---|---|
force | Vector3 | — |
ApplyCentralImpulsevoid
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).
| Name | Type | Default |
|---|---|---|
impulse | Vector3 | — |
ApplyForcevoid
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.
| Name | Type | Default |
|---|---|---|
pointIndex | int | — |
force | Vector3 | — |
ApplyImpulsevoid
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).
| Name | Type | Default |
|---|---|---|
pointIndex | int | — |
impulse | Vector3 | — |
GetCollisionExceptionsReckfell.Collections.Array<PhysicsBody3D>
public Reckfell.Collections.Array<PhysicsBody3D> GetCollisionExceptions();Returns an array of nodes that were added as collision exceptions for this body.
Reckfell.Collections.Array<PhysicsBody3D>GetCollisionLayeruint
public uint GetCollisionLayer();uintGetCollisionLayerValuebool
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetCollisionMaskuint
public uint GetCollisionMask();uintGetCollisionMaskValuebool
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetDampingCoefficientfloat
public float GetDampingCoefficient();floatGetDisableModeSoftBody3D.DisableModeEnum
public SoftBody3D.DisableModeEnum GetDisableMode();SoftBody3D.DisableModeEnumGetDragCoefficientfloat
public float GetDragCoefficient();floatGetLinearStiffnessfloat
public float GetLinearStiffness();floatGetParentCollisionIgnoreEntityPath
public EntityPath GetParentCollisionIgnore();EntityPathGetPhysicsRidRid
public Rid GetPhysicsRid();Returns the internal Rid used by the PhysicsServer3D for this body.
RidGetPointCountint
public int GetPointCount();intGetPointTransformVector3
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.
| Name | Type | Default |
|---|---|---|
pointIndex | int | — |
Vector3GetPressureCoefficientfloat
public float GetPressureCoefficient();floatGetShrinkingFactorfloat
public float GetShrinkingFactor();floatGetSimulationPrecisionint
public int GetSimulationPrecision();intGetTotalMassfloat
public float GetTotalMass();floatIsPointPinnedbool
public bool IsPointPinned(int pointIndex);Returns true if vertex is set to pinned.
| Name | Type | Default |
|---|---|---|
pointIndex | int | — |
boolIsRayPickablebool
public bool IsRayPickable();boolRemoveCollisionExceptionWithvoid
public void RemoveCollisionExceptionWith(Entity body);Removes a body from the list of bodies that this body can't collide with.
| Name | Type | Default |
|---|---|---|
body | Entity | — |
SetCollisionLayervoid
public void SetCollisionLayer(uint collisionLayer);| Name | Type | Default |
|---|---|---|
collisionLayer | uint | — |
SetCollisionLayerValuevoid
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetCollisionMaskvoid
public void SetCollisionMask(uint collisionMask);| Name | Type | Default |
|---|---|---|
collisionMask | uint | — |
SetCollisionMaskValuevoid
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetDampingCoefficientvoid
public void SetDampingCoefficient(float dampingCoefficient);| Name | Type | Default |
|---|---|---|
dampingCoefficient | float | — |
SetDisableModevoid
public void SetDisableMode(SoftBody3D.DisableModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | SoftBody3D.DisableModeEnum | — |
SetDragCoefficientvoid
public void SetDragCoefficient(float dragCoefficient);| Name | Type | Default |
|---|---|---|
dragCoefficient | float | — |
SetLinearStiffnessvoid
public void SetLinearStiffness(float linearStiffness);| Name | Type | Default |
|---|---|---|
linearStiffness | float | — |
SetParentCollisionIgnorevoid
public void SetParentCollisionIgnore(EntityPath parentCollisionIgnore);| Name | Type | Default |
|---|---|---|
parentCollisionIgnore | EntityPath | — |
SetPointPinned2 overloads
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.
| Name | Type | Default |
|---|---|---|
pointIndex | int | — |
pinned | bool | — |
attachmentPath | EntityPath | — |
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.
| Name | Type | Default |
|---|---|---|
pointIndex | int | — |
pinned | bool | — |
attachmentPath | EntityPath | null |
insertAt | int | -1 |
SetPressureCoefficientvoid
public void SetPressureCoefficient(float pressureCoefficient);| Name | Type | Default |
|---|---|---|
pressureCoefficient | float | — |
SetRayPickablevoid
public void SetRayPickable(bool rayPickable);| Name | Type | Default |
|---|---|---|
rayPickable | bool | — |
SetShrinkingFactorvoid
public void SetShrinkingFactor(float shrinkingFactor);| Name | Type | Default |
|---|---|---|
shrinkingFactor | float | — |
SetSimulationPrecisionvoid
public void SetSimulationPrecision(int simulationPrecision);| Name | Type | Default |
|---|---|---|
simulationPrecision | int | — |
SetTotalMassvoid
public void SetTotalMass(float mass);| Name | Type | Default |
|---|---|---|
mass | float | — |
SoftBody3D.DisableModeEnum
| Value | Description |
|---|---|
KeepActive = 1 | When |
Remove = 0 | When |