Documentation
¶
Overview ¶
A deformable 3D physics mesh. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials.
Additionally, graphics.gd/classdb/SoftBody3D is subject to wind forces defined in graphics.gd/classdb/Area3D (see graphics.gd/classdb/Area3D.Instance.WindSourcePath, graphics.gd/classdb/Area3D.Instance.WindForceMagnitude, and graphics.gd/classdb/Area3D.Instance.WindAttenuationFactor).
Note: It's recommended to use Jolt Physics when using graphics.gd/classdb/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 graphics.gd/classdb/ProjectSettings "physics/3d/physics_engine" project setting.
Index ¶
- type Advanced
- type Any
- type DisableMode
- type Expanded
- type Extension
- func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self *Extension[T]) AsMeshInstance3D() MeshInstance3D.Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode3D() Node3D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsSoftBody3D() Instance
- func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
- type ID
- type Instance
- func (self Instance) AddCollisionExceptionWith(body Node.Instance)
- func (self Instance) ApplyCentralForce(force Vector3.XYZ)
- func (self Instance) ApplyCentralImpulse(impulse Vector3.XYZ)
- func (self Instance) ApplyForce(point_index int, force Vector3.XYZ)
- func (self Instance) ApplyImpulse(point_index int, impulse Vector3.XYZ)
- func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self Instance) AsMeshInstance3D() MeshInstance3D.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsSoftBody3D() Instance
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) CollisionLayer() int
- func (self Instance) CollisionMask() int
- func (self Instance) DampingCoefficient() Float.X
- func (self Instance) DisableMode() DisableMode
- func (self Instance) DragCoefficient() Float.X
- func (self Instance) GetCollisionExceptions() []PhysicsBody3D.Instance
- func (self Instance) GetCollisionLayerValue(layer_number int) bool
- func (self Instance) GetCollisionMaskValue(layer_number int) bool
- func (self Instance) GetPhysicsRid() RID.SoftBody3D
- func (self Instance) GetPointTransform(point_index int) Vector3.XYZ
- func (self Instance) ID() ID
- func (self Instance) IsPointPinned(point_index int) bool
- func (self Instance) LinearStiffness() Float.X
- func (self Instance) ParentCollisionIgnore() string
- func (self Instance) PressureCoefficient() Float.X
- func (self Instance) RayPickable() bool
- func (self Instance) RemoveCollisionExceptionWith(body Node.Instance)
- func (self Instance) SetCollisionLayer(value int)
- func (self Instance) SetCollisionLayerValue(layer_number int, value bool)
- func (self Instance) SetCollisionMask(value int)
- func (self Instance) SetCollisionMaskValue(layer_number int, value bool)
- func (self Instance) SetDampingCoefficient(value Float.X)
- func (self Instance) SetDisableMode(value DisableMode)
- func (self Instance) SetDragCoefficient(value Float.X)
- func (self Instance) SetLinearStiffness(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetParentCollisionIgnore(value string)
- func (self Instance) SetPointPinned(point_index int, pinned bool)
- func (self Instance) SetPressureCoefficient(value Float.X)
- func (self Instance) SetRayPickable(value bool)
- func (self Instance) SetShrinkingFactor(value Float.X)
- func (self Instance) SetSimulationPrecision(value int)
- func (self Instance) SetTotalMass(value Float.X)
- func (self Instance) ShrinkingFactor() Float.X
- func (self Instance) SimulationPrecision() int
- func (self Instance) TotalMass() Float.X
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type DisableMode ¶
type DisableMode int //gd:SoftBody3D.DisableMode
const ( // When [graphics.gd/classdb/Node.Instance.ProcessMode] is set to [Node.ProcessModeDisabled], remove from the physics simulation to stop all physics interactions with this [graphics.gd/classdb/SoftBody3D]. // // Automatically re-added to the physics simulation when the [graphics.gd/classdb/Node] is processed again. DisableModeRemove DisableMode = 0 // When [graphics.gd/classdb/Node.Instance.ProcessMode] is set to [Node.ProcessModeDisabled], do not affect the physics simulation. DisableModeKeepActive DisableMode = 1 )
type Expanded ¶
type Expanded [1]gdclass.SoftBody3D
func (Expanded) SetPointPinned ¶
func (self Expanded) SetPointPinned(point_index int, pinned bool, attachment_path string, insert_at int)
Sets the pinned state of a surface vertex. When set to true, the optional 'attachment_path' can define a graphics.gd/classdb/Node3D the pinned vertex will be attached to.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsGeometryInstance3D ¶
func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
func (*Extension[T]) AsMeshInstance3D ¶
func (self *Extension[T]) AsMeshInstance3D() MeshInstance3D.Instance
func (*Extension[T]) AsSoftBody3D ¶
func (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.SoftBody3D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddCollisionExceptionWith ¶
Adds a body to the list of bodies that this body can't collide with.
func (Instance) ApplyCentralForce ¶
Distributes and applies a force to all points. A force is time dependent and meant to be applied every physics update.
func (Instance) ApplyCentralImpulse ¶
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 (Instance) ApplyForce ¶
Applies a force to a point. A force is time dependent and meant to be applied every physics update.
func (Instance) ApplyImpulse ¶
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 (Instance) AsGeometryInstance3D ¶
func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
func (Instance) AsMeshInstance3D ¶
func (self Instance) AsMeshInstance3D() MeshInstance3D.Instance
func (Instance) AsSoftBody3D ¶
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) CollisionLayer ¶
func (Instance) CollisionMask ¶
func (Instance) DampingCoefficient ¶
func (Instance) DisableMode ¶
func (self Instance) DisableMode() DisableMode
func (Instance) DragCoefficient ¶
func (Instance) GetCollisionExceptions ¶
func (self Instance) GetCollisionExceptions() []PhysicsBody3D.Instance
Returns an array of nodes that were added as collision exceptions for this body.
func (Instance) GetCollisionLayerValue ¶
Returns whether or not the specified layer of the Instance.CollisionLayer is enabled, given a 'layer_number' between 1 and 32.
func (Instance) GetCollisionMaskValue ¶
Returns whether or not the specified layer of the Instance.CollisionMask is enabled, given a 'layer_number' between 1 and 32.
func (Instance) GetPhysicsRid ¶
func (self Instance) GetPhysicsRid() RID.SoftBody3D
Returns the internal [Resource.ID] used by the graphics.gd/classdb/PhysicsServer3D for this body.
func (Instance) GetPointTransform ¶
Returns local translation of a vertex in the surface array.
func (Instance) IsPointPinned ¶
Returns true if vertex is set to pinned.
func (Instance) LinearStiffness ¶
func (Instance) ParentCollisionIgnore ¶
func (Instance) PressureCoefficient ¶
func (Instance) RayPickable ¶
func (Instance) RemoveCollisionExceptionWith ¶
Removes a body from the list of bodies that this body can't collide with.
func (Instance) SetCollisionLayer ¶
func (Instance) SetCollisionLayerValue ¶
Based on 'value', enables or disables the specified layer in the Instance.CollisionLayer, given a 'layer_number' between 1 and 32.
func (Instance) SetCollisionMask ¶
func (Instance) SetCollisionMaskValue ¶
Based on 'value', enables or disables the specified layer in the Instance.CollisionMask, given a 'layer_number' between 1 and 32.
func (Instance) SetDampingCoefficient ¶
func (Instance) SetDisableMode ¶
func (self Instance) SetDisableMode(value DisableMode)
func (Instance) SetDragCoefficient ¶
func (Instance) SetLinearStiffness ¶
func (Instance) SetParentCollisionIgnore ¶
func (Instance) SetPointPinned ¶
Sets the pinned state of a surface vertex. When set to true, the optional 'attachment_path' can define a graphics.gd/classdb/Node3D the pinned vertex will be attached to.