pub struct Builder {Show 13 fields
pub transform: Isometry3<f32>,
pub trimesh: Option<TriMesh>,
pub mesh: Option<Mesh>,
pub collider_radius: Option<f32>,
pub collider_skin: Option<f32>,
pub mass: Option<f32>,
pub substeps: Option<usize>,
pub stiffness: Option<Stiffness<f32>>,
pub partial_constraints: Vec<(Vector3<f32>, DistanceBuilder<false, true, true>)>,
pub extra_constraints: Vec<Distance>,
pub linear_damping: Option<f32>,
pub distance_constraint_damping: Option<f32>,
pub tetrahedra_volume_constraint_damping: Option<f32>,
}Expand description
Build an XPBD body
Fields§
§transform: Isometry3<f32>§trimesh: Option<TriMesh>§mesh: Option<Mesh>§collider_radius: Option<f32>§collider_skin: Option<f32>§mass: Option<f32>§substeps: Option<usize>§stiffness: Option<Stiffness<f32>>§partial_constraints: Vec<(Vector3<f32>, DistanceBuilder<false, true, true>)>§extra_constraints: Vec<Distance>§linear_damping: Option<f32>§distance_constraint_damping: Option<f32>§tetrahedra_volume_constraint_damping: Option<f32>Implementations§
Source§impl Builder
impl Builder
pub fn new() -> Self
Sourcepub fn stiffness(self, young: f32, poisson: f32) -> Self
pub fn stiffness(self, young: f32, poisson: f32) -> Self
Sets the default stiffness for all constraints, in real-world units (Young’s modulus and poisson constant)
(required)
Sourcepub fn substeps(self, substeps: usize) -> Self
pub fn substeps(self, substeps: usize) -> Self
Number of XPBD simulation substeps.
Has significant impact on accuracy.
For dt of 1/60th of a second, accuracy will significantly improve up to ~200 substeps, then diminishing returns beyond.
Defaults to 100 (a moderately high default)
Sourcepub fn collider_radius(self, collider_radius: f32) -> Self
pub fn collider_radius(self, collider_radius: f32) -> Self
Radius of spherical colliders for particles
Sourcepub fn collider_skin(self, collider_skin: f32) -> Self
pub fn collider_skin(self, collider_skin: f32) -> Self
Set default stand-off collision radius for particles, effectively adding this amount to the spheres’ radii without making them visually larger
Sourcepub fn linear_damping(self, d: f32) -> Self
pub fn linear_damping(self, d: f32) -> Self
Set particle linear damping
Sourcepub fn tetrahedra_volume_constraint_damping(self, d: f32) -> Self
pub fn tetrahedra_volume_constraint_damping(self, d: f32) -> Self
Set default volume constraint damping (not linear damping ex. air friction)
Sourcepub fn distance_constraint_damping(self, d: f32) -> Self
pub fn distance_constraint_damping(self, d: f32) -> Self
Set default distance constraint damping (not linear damping ex. air friction)
Sourcepub fn extra_constraint(self, constraint: Distance) -> Self
pub fn extra_constraint(self, constraint: Distance) -> Self
Add an extra distance constraint between two rigid bodies.
Sourcepub fn extra_constraints(self, iter: impl IntoIterator<Item = Distance>) -> Self
pub fn extra_constraints(self, iter: impl IntoIterator<Item = Distance>) -> Self
Shorthand for calling .extra_constraint on each item in an iterator
Sourcepub fn partial_constraint(
self,
at: Vector3<f32>,
constraint: DistanceBuilder<false, true, true>,
) -> Self
pub fn partial_constraint( self, at: Vector3<f32>, constraint: DistanceBuilder<false, true, true>, ) -> Self
Add a distance constraint between a rigid body you have already created, and the particle that will be in the XPBD body.
Sourcepub fn partial_constraints(
self,
iter: impl IntoIterator<Item = (Vector3<f32>, DistanceBuilder<false, true, true>)>,
) -> Self
pub fn partial_constraints( self, iter: impl IntoIterator<Item = (Vector3<f32>, DistanceBuilder<false, true, true>)>, ) -> Self
Shorthand for calling .partial_constraint on each item in an iterator
fn build_constraints( distance_constraints: Vec<Distance>, volume_constraints: Vec<TetrahedronVolume>, ixmap: &mut FxHashMap<RigidBodyHandle, usize>, handles: &mut Vec<RigidBodyHandle>, ) -> Vec<Constraint>
Sourcepub fn build(
self,
xpbd: &mut Set,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
) -> Result<Handle, Error>
pub fn build( self, xpbd: &mut Set, bodies: &mut RigidBodySet, colliders: &mut ColliderSet, ) -> Result<Handle, Error>
Build the body
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.