Skip to main content

Rigidbodies

Each region of the softbody is a rigidbody. The actual hierarchy inside the node is as follows:

  • RigidBody2D: contains
    • CollisionShape2D
    • RemoteTransform2D
    • Joint2D nodes

The bodies are the softbody's particles: they collide with the world, the joints hold them together, and the texture follows them.

Rigidbody properties​

The RigidBody parameter section contains options to change properties of the rigidbody. All options are per every rigidbody:

  • Mass: Makes the softbody heavier by changing the mass of every rigidbody. Make sure to also update the joint properties, otherwise the softbody will collapse in itself.
  • Can Sleep: Whether the bodies may sleep when they come to rest.
  • Gravity Scale: Controls the gravity scale of every rigidbody.
  • Constant Force / Constant Torque: Applied to every rigidbody.
  • Collision Layer / Collision Mask: Of every rigidbody.
  • Exclude Array: Nodes the bodies never collide with, for example the character carrying the softbody.
  • Rigidbody Scene: A scene with a RigidBody2D root that is instantiated for every body. This is useful if you want to add a custom script on the rigidbodies created; the root may extend SoftBody2DRigidBody to receive the rigidbody_created signal.
  • Physics Material Override: Controls the material override property of every rigidbody. Use this to make the softbody slippery or bouncy.
  • Linear Damp / Angular Damp: A slightly overdamped softbody reads as softer and settles without jitter.

Talking to the bodies from code​

get_rigid_bodies() returns one SoftBodyChild per body. apply_impulse(), apply_force() and apply_impulse_at_point() push every body at once. See Scripting for examples and the Class Reference for the full list.