pub struct SoftBodySharedSettingsBuilder { /* private fields */ }Expand description
Collects the vertices, faces and constraints of SoftBodySharedSettings; made by
SoftBodySharedSettings::builder.
Implementations§
Sourcepub fn create_constraints(
self,
bend: SoftBodyBendType,
attributes: SoftBodyVertexAttributes,
) -> Self
pub fn create_constraints( self, bend: SoftBodyBendType, attributes: SoftBodyVertexAttributes, ) -> Self
Creates edge, shear, bend and LRA constraints from the faces, every vertex with the
same attributes (Jolt SoftBodySharedSettings::CreateConstraints, with its default
angle tolerance of 8° for detecting quads). Replaces an earlier call.
Sourcepub fn create_constraints_per_vertex(
self,
bend: SoftBodyBendType,
attributes: Vec<SoftBodyVertexAttributes>,
) -> Self
pub fn create_constraints_per_vertex( self, bend: SoftBodyBendType, attributes: Vec<SoftBodyVertexAttributes>, ) -> Self
Like create_constraints with one attribute set per vertex,
in vertex order; there must be exactly as many as vertices.
Sourcepub fn edge(self, edge: SoftBodyEdge) -> Self
pub fn edge(self, edge: SoftBodyEdge) -> Self
Adds an edge constraint, kept in addition to the generated ones. Long range attachments follow the generated edges only.
Sourcepub fn dihedral_bend(self, bend: SoftBodyDihedralBend) -> Self
pub fn dihedral_bend(self, bend: SoftBodyDihedralBend) -> Self
Adds a dihedral bend constraint, kept in addition to the generated ones.
Sourcepub fn volume(self, volume: SoftBodyVolume) -> Self
pub fn volume(self, volume: SoftBodyVolume) -> Self
Adds a volume constraint, for example one per tetrahedron of a solid soft body.
Sourcepub fn build(self) -> Result<SoftBodySharedSettings, SoftBodyError>
pub fn build(self) -> Result<SoftBodySharedSettings, SoftBodyError>
Checks everything and builds the settings; nothing is allocated when a check fails.
Fails with SoftBodyError::InvalidValue when:
- there is no vertex;
- a vertex position is beyond
limits::MAX_SHAPE_EXTENT, a velocity beyondlimits::MAX_LINEAR_VELOCITY, or an inverse mass neither 0 nor the inverse of a mass withinlimits::MIN_MASS..=limits::MAX_MASS; - the masses of the movable vertices add up to more than
limits::MAX_MASS(Jolt gives the body their sum as its mass); - a face names a vertex that does not exist or one vertex twice, has no area, or has an
edge shorter than
limits::MIN_SOFT_BODY_EDGE_LENGTH; - with
SoftBodyBendType::Distance, the vertices opposite a shared edge are closer than that length (the bend edge between them would have no length); - an attribute is out of range, or a per-vertex attribute does not have one value per vertex;
- an explicit constraint names a vertex that does not exist or one vertex twice, has a
compliance out of range or an edge (or a bend’s shared edge) shorter than
limits::MIN_SOFT_BODY_EDGE_LENGTH, or is a tetrahedron without volume.