soft_body_removal
Removing a soft-body (PhysicsWorld::remove_soft_bodySoftBody componentWorld.removeSoftBodyr3RemoveSoftBodyPhysicsWorld.remove_soft_bodyPhysicsWorld::remove_soft_body_clusterSoftBodyCluster componentWorld.removeSoftBodyClusterr3SoftBody_RemoveClusterPhysicsWorld.remove_soft_body_cluster
- Example 2D
- Example 3D
// Removing a soft body removes its root body, its proxies, its colliders and the joints
// attached to them.
world.remove_soft_body(rope_handle);
// A cluster can be removed on its own.
world.remove_soft_body_cluster(jelly_handle, cluster);
// Removing a soft body removes its root body, its proxies, its colliders and the joints
// attached to them.
world.remove_soft_body(rope_handle);
// A cluster can be removed on its own.
world.remove_soft_body_cluster(jelly_handle, cluster);
- Example 2D
- Example 3D
// Removing a soft body removes its root body, its proxies, its colliders and the joints
// attached to them.
world.removeSoftBody(rope);
// A cluster can be removed on its own.
world.removeSoftBodyCluster(jelly, cluster);
// Removing a soft body removes its root body, its proxies, its colliders and the joints
// attached to them.
world.removeSoftBody(rope);
// A cluster can be removed on its own.
world.removeSoftBodyCluster(jelly, cluster);
- Example 2D
- Example 3D
fn remove_soft_bodies(
mut commands: Commands,
rope: Single<Entity, With<Rope>>,
cluster: Single<Entity, With<PlateCluster>>,
) {
// Despawning a soft-body entity (or removing its `SoftBody` component) removes its root
// body, its proxies, its colliders and the joints attached to them.
commands.entity(*rope).despawn();
// Despawning a cluster entity (or removing its `SoftBodyCluster` component) removes the
// cluster.
commands.entity(*cluster).despawn();
}
fn remove_soft_bodies(
mut commands: Commands,
rope: Single<Entity, With<Rope>>,
cluster: Single<Entity, With<PlateCluster>>,
) {
// Despawning a soft-body entity (or removing its `SoftBody` component) removes its root
// body, its proxies, its colliders and the joints attached to them.
commands.entity(*rope).despawn();
// Despawning a cluster entity (or removing its `SoftBodyCluster` component) removes the
// cluster.
commands.entity(*cluster).despawn();
}
- Example 2D
- Example 3D
// Removing a soft-body removes its root body, its proxies, its colliders and the joints
// attached to them.
r2RemoveSoftBody(rope_handle);
// A cluster can be removed on its own.
r2SoftBody_RemoveCluster(jelly_handle, cluster);
// Removing a soft-body removes its root body, its proxies, its colliders and the joints
// attached to them.
r3RemoveSoftBody(rope_handle);
// A cluster can be removed on its own.
r3SoftBody_RemoveCluster(jelly_handle, cluster);
# Removing a soft body removes its root body, its proxies, its colliders and the joints
# attached to them.
world.remove_soft_body(rope_handle)
# A cluster can be removed on its own.
world.remove_soft_body_cluster(jelly_handle, cluster)
Removing a cluster also removes the particles that only this cluster covered, with their elements and their
attachments. Therefore removing the last cluster of a soft-body removes the soft-body itself. Note that removing the
proxy of a cluster r3RemoveRigidBodyPhysicsWorld.remove_body, or with RigidBodySet.remove given the soft-body set as its soft_bodies argument, without which it raises a ValueError)