SoftBody2D
class in OpalScript
Deformable jelly and cloth with a textured mesh, spring connections, collisions, and pinned edges. Add directly to a sprite or shape, then choose a preset in the inspector.
Properties
| Member | Description |
|---|---|
| SoftBody2D.SimulationPosition | Read-only world position from the latest physics step, in pixels. Unlike Transform.WorldPosition, this is the simulation pose rather than the interpolated visual pose. |
| SoftBody2D.SimulationRotation | Read-only simulation rotation in degrees from the latest physics step. |
| SoftBody2D.Enabled | Whether this component is enabled. Use SetEnabled to change it. |
| SoftBody2D.Speed | Speed of the body's center of mass (pixels/second). |
| SoftBody2D.Deformation | Average relative change in mesh edge lengths. 0 is at rest; 0.1 is approximately ten percent stretch or compression. |
| SoftBody2D.ContactCount | Number of other scene objects currently touching this soft body. |
| SoftBody2D.ParticleCount | Number of particles in the running simulation. |
Methods
| Member | Description |
|---|---|
| SoftBody2D.ApplyImpulse | Distribute a world-space impulse across movable particles. Total Mass determines the resulting velocity change. |
| SoftBody2D.SetVelocity | Set every movable particle's velocity in pixels/second. |
| SoftBody2D.ResetShape | Restore the mesh's starting shape and initial velocities. |
| SoftBody2D.SetEnabled | Enable or disable this component's behavior. |