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

source

pub fn new(shape: Shape) -> Self

Initialize a new collider builder with the given shape.

source

pub fn build(self) -> Collider

source

pub fn compound(shapes: Vec<(Transform, Shape)>) -> Self

Initialize a new collider builder with a compound shape.

source

pub fn circle(radius: Real) -> Self

Initialize a new collider builder with a circle shape defined by its radius.

source

pub fn square(hx: Real, hy: Real) -> Self

Initialize a new collider builder with a cuboid shape defined by its half-extents.

source

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.

source

pub fn capsule(a: Vec2, b: Vec2, radius: Real) -> Self

Initialize a capsule collider from its endpoints and radius.

source

pub fn capsule_x(half_height: Real, radius: Real) -> Self

Initialize a new collider builder with a capsule shape aligned with the x axis.

source

pub fn capsule_y(half_height: Real, radius: Real) -> Self

Initialize a new collider builder with a capsule shape aligned with the y axis.

source

pub fn segment(a: Vec2, b: Vec2) -> Self

Initializes a collider builder with a segment shape.

source

pub fn triangle(a: Vec2, b: Vec2, c: Vec2) -> Self

Initializes a collider builder with a triangle shape.

source

pub fn round_triangle(a: Vec2, b: Vec2, c: Vec2, radius: Real) -> Self

Initializes a collider builder with a triangle shape with round corners.

source

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.

source

pub fn trimesh(data: Data) -> Self

Initializes a collider builder with a triangle mesh shape defined by its vertex and index buffers.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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).

source

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.

source

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.

source

pub fn from_shared_shape(shape: SharedShape) -> Self

Make a collider from a Rapier or Parry shape.

source

pub fn sensor(self, is_sensor: bool) -> Self

Sets whether or not the collider built by this builder is a sensor.

source

pub fn friction(self, friction: Real) -> Self

Sets the friction coefficient of the collider this builder will build.

source

pub fn friction_combine_rule(self, rule: CoefficientCombineRule) -> Self

Sets the rule to be used to combine two friction coefficients in a contact.

source

pub fn restitution(self, restitution: Real) -> Self

Sets the restitution coefficient of the collider this builder will build.

source

pub fn restitution_combine_rule(self, rule: CoefficientCombineRule) -> Self

Sets the rule to be used to combine two restitution coefficients in a contact.

source

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.

source

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.

source

pub fn enabled(self, enabled: bool) -> Self

Enable or disable the collider after its creation.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,