Struct let_engine::objects::physics::ColliderBuilder
source · pub struct ColliderBuilder {Show 15 fields
pub shape: Shape,
pub mass_properties: ColliderMassProps,
pub friction: Real,
pub friction_combine_rule: CoefficientCombineRule,
pub restitution: Real,
pub restitution_combine_rule: CoefficientCombineRule,
pub transform: Transform,
pub is_sensor: bool,
pub active_collision_types: ActiveCollisionTypes,
pub active_hooks: ActiveHooks,
pub active_events: ActiveEvents,
pub collision_groups: InteractionGroups,
pub solver_groups: InteractionGroups,
pub enabled: bool,
pub contact_force_event_threshold: Real,
}
Fields§
§shape: Shape
§mass_properties: ColliderMassProps
§friction: Real
§friction_combine_rule: CoefficientCombineRule
§restitution: Real
§restitution_combine_rule: CoefficientCombineRule
§transform: Transform
§is_sensor: bool
§active_collision_types: ActiveCollisionTypes
§active_hooks: ActiveHooks
§active_events: ActiveEvents
§collision_groups: InteractionGroups
§solver_groups: InteractionGroups
§enabled: bool
§contact_force_event_threshold: Real
Implementations§
source§impl ColliderBuilder
impl ColliderBuilder
pub fn build(self) -> Collider
sourcepub fn compound(shapes: Vec<(Transform, Shape)>) -> Self
pub fn compound(shapes: Vec<(Transform, Shape)>) -> Self
Initialize a new collider builder with a compound shape.
sourcepub fn circle(radius: Real) -> Self
pub fn circle(radius: Real) -> Self
Initialize a new collider builder with a circle shape defined by its radius.
sourcepub fn square(hx: Real, hy: Real) -> Self
pub fn square(hx: Real, hy: Real) -> Self
Initialize a new collider builder with a cuboid shape defined by its half-extents.
sourcepub fn rounded_square(hx: Real, hy: Real, border_radius: Real) -> Self
pub fn rounded_square(hx: Real, hy: Real, border_radius: Real) -> Self
Initialize a new collider builder with a round cuboid shape defined by its half-extents and border radius.
sourcepub fn capsule(a: Vec2, b: Vec2, radius: Real) -> Self
pub fn capsule(a: Vec2, b: Vec2, radius: Real) -> Self
Initialize a capsule collider from its endpoints and radius.
sourcepub fn capsule_x(half_height: Real, radius: Real) -> Self
pub fn capsule_x(half_height: Real, radius: Real) -> Self
Initialize a new collider builder with a capsule shape aligned with the x
axis.
sourcepub fn capsule_y(half_height: Real, radius: Real) -> Self
pub fn capsule_y(half_height: Real, radius: Real) -> Self
Initialize a new collider builder with a capsule shape aligned with the y
axis.
sourcepub fn triangle(a: Vec2, b: Vec2, c: Vec2) -> Self
pub fn triangle(a: Vec2, b: Vec2, c: Vec2) -> Self
Initializes a collider builder with a triangle shape.
sourcepub fn round_triangle(a: Vec2, b: Vec2, c: Vec2, radius: Real) -> Self
pub fn round_triangle(a: Vec2, b: Vec2, c: Vec2, radius: Real) -> Self
Initializes a collider builder with a triangle shape with round corners.
sourcepub fn polyline(vertices: Vec<Vec2>, indices: Option<Vec<[u32; 2]>>) -> Self
pub fn polyline(vertices: Vec<Vec2>, indices: Option<Vec<[u32; 2]>>) -> Self
Initializes a collider builder with a polyline shape defined by its vertex and index buffers.
sourcepub fn trimesh(data: Data) -> Self
pub fn trimesh(data: Data) -> Self
Initializes a collider builder with a triangle mesh shape defined by its vertex and index buffers.
sourcepub fn convex_decomposition(vertices: &[Vec2], indices: &[[u32; 2]]) -> Self
pub fn convex_decomposition(vertices: &[Vec2], indices: &[[u32; 2]]) -> Self
Initializes a collider builder with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts.
sourcepub fn round_convex_decomposition(
vertices: &[Vec2],
indices: &[[u32; 2]],
radius: Real
) -> Self
pub fn round_convex_decomposition( vertices: &[Vec2], indices: &[[u32; 2]], radius: Real ) -> Self
Initializes a collider builder with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts dilated with round corners.
sourcepub fn convex_decomposition_with_params(
vertices: &[Vec2],
indices: &[[u32; 2]],
params: &VHACDParameters
) -> Self
pub fn convex_decomposition_with_params( vertices: &[Vec2], indices: &[[u32; 2]], params: &VHACDParameters ) -> Self
Initializes a collider builder with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts.
sourcepub fn round_convex_decomposition_with_params(
vertices: &[Vec2],
indices: &[[u32; 2]],
params: &VHACDParameters,
radius: Real
) -> Self
pub fn round_convex_decomposition_with_params( vertices: &[Vec2], indices: &[[u32; 2]], params: &VHACDParameters, radius: Real ) -> Self
Initializes a collider builder with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts dilated with round corners.
sourcepub fn convex_hull(points: &[Vec2]) -> Option<Self>
pub fn convex_hull(points: &[Vec2]) -> Option<Self>
Initializes a new collider builder with a 2D convex polygon or 3D convex polyhedron obtained after computing the convex-hull of the given points.
sourcepub fn round_convex_hull(points: &[Vec2], border_radius: Real) -> Option<Self>
pub fn round_convex_hull(points: &[Vec2], border_radius: Real) -> Option<Self>
Initializes a new collider builder with a round 2D convex polygon or 3D convex polyhedron
obtained after computing the convex-hull of the given points. The shape is dilated
by a sphere of radius border_radius
.
sourcepub fn convex_polyline(points: &[Vec2]) -> Option<Self>
pub fn convex_polyline(points: &[Vec2]) -> Option<Self>
Creates a new collider builder that is a convex polygon formed by the given polyline assumed to be convex (no convex-hull will be automatically computed).
sourcepub fn round_convex_polyline(
points: Vec<Vec2>,
border_radius: Real
) -> Option<Self>
pub fn round_convex_polyline( points: Vec<Vec2>, border_radius: Real ) -> Option<Self>
Creates a new collider builder that is a round convex polygon formed by the
given polyline assumed to be convex (no convex-hull will be automatically
computed). The polygon shape is dilated by a sphere of radius border_radius
.
sourcepub fn heightfield(heights: Vec<Real>, scale: Vec2) -> Self
pub fn heightfield(heights: Vec<Real>, scale: Vec2) -> Self
Initializes a collider builder with a heightfield shape defined by its set of height and a scale factor along each coordinate axis.
Make a collider from a Rapier or Parry shape.
sourcepub fn sensor(self, is_sensor: bool) -> Self
pub fn sensor(self, is_sensor: bool) -> Self
Sets whether or not the collider built by this builder is a sensor.
sourcepub fn friction(self, friction: Real) -> Self
pub fn friction(self, friction: Real) -> Self
Sets the friction coefficient of the collider this builder will build.
sourcepub fn friction_combine_rule(self, rule: CoefficientCombineRule) -> Self
pub fn friction_combine_rule(self, rule: CoefficientCombineRule) -> Self
Sets the rule to be used to combine two friction coefficients in a contact.
sourcepub fn restitution(self, restitution: Real) -> Self
pub fn restitution(self, restitution: Real) -> Self
Sets the restitution coefficient of the collider this builder will build.
sourcepub fn restitution_combine_rule(self, rule: CoefficientCombineRule) -> Self
pub fn restitution_combine_rule(self, rule: CoefficientCombineRule) -> Self
Sets the rule to be used to combine two restitution coefficients in a contact.
sourcepub fn density(self, density: Real) -> Self
pub fn density(self, density: Real) -> Self
Sets the uniform density of the collider this builder will build.
This will be overridden by a call to Self::mass
or Self::mass_properties
so it only
makes sense to call either Self::density
or Self::mass
or Self::mass_properties
.
The mass and angular inertia of this collider will be computed automatically based on its shape.
sourcepub fn mass(self, mass: Real) -> Self
pub fn mass(self, mass: Real) -> Self
Sets the mass of the collider this builder will build.
This will be overridden by a call to Self::density
or Self::mass_properties
so it only
makes sense to call either Self::density
or Self::mass
or Self::mass_properties
.
The angular inertia of this collider will be computed automatically based on its shape and this mass value.
Auto Trait Implementations§
impl !RefUnwindSafe for ColliderBuilder
impl Send for ColliderBuilder
impl Sync for ColliderBuilder
impl Unpin for ColliderBuilder
impl !UnwindSafe for ColliderBuilder
Blanket Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.