[][src]Struct specs_physics::colliders::PhysicsColliderBuilder

pub struct PhysicsColliderBuilder<N: RealField> { /* fields omitted */ }

The PhysicsColliderBuilder implements the builder pattern for PhysicsColliders and is the recommended way of instantiating and customising new PhysicsCollider instances.

Example

use specs_physics::{
    colliders::Shape,
    nalgebra::Isometry3,
    ncollide::world::CollisionGroups,
    nphysics::material::{BasicMaterial, MaterialHandle},
    PhysicsColliderBuilder,
};

let physics_collider = PhysicsColliderBuilder::from(Shape::Rectangle(10.0, 10.0, 1.0))
    .offset_from_parent(Isometry3::identity())
    .density(1.2)
    .material(MaterialHandle::new(BasicMaterial::default()))
    .margin(0.02)
    .collision_groups(CollisionGroups::default())
    .linear_prediction(0.001)
    .angular_prediction(0.0)
    .sensor(true)
    .build();

Methods

impl<N: RealField> PhysicsColliderBuilder<N>[src]

pub fn offset_from_parent(self, offset_from_parent: Isometry3<N>) -> Self[src]

Sets the offset_from_parent value of the PhysicsColliderBuilder.

pub fn density(self, density: N) -> Self[src]

Sets the density value of the PhysicsColliderBuilder.

pub fn material(self, material: MaterialHandle<N>) -> Self[src]

Sets the material value of the PhysicsColliderBuilder.

pub fn margin(self, margin: N) -> Self[src]

Sets the margin value of the PhysicsColliderBuilder.

pub fn collision_groups(self, collision_groups: CollisionGroups) -> Self[src]

Sets the collision_groups value of the PhysicsColliderBuilder.

pub fn linear_prediction(self, linear_prediction: N) -> Self[src]

Sets the linear_prediction value of the PhysicsColliderBuilder.

pub fn angular_prediction(self, angular_prediction: N) -> Self[src]

Sets the angular_prediction value of the PhysicsColliderBuilder.

pub fn sensor(self, sensor: bool) -> Self[src]

Sets the sensor value of the PhysicsColliderBuilder.

pub fn build(self) -> PhysicsCollider<N>[src]

Builds the PhysicsCollider from the values set in the PhysicsColliderBuilder instance.

Trait Implementations

impl<N: RealField> From<Shape<N>> for PhysicsColliderBuilder<N>[src]

fn from(shape: Shape<N>) -> Self[src]

Creates a new PhysicsColliderBuilder from the given Shape. This

Auto Trait Implementations

impl<N> Send for PhysicsColliderBuilder<N> where
    N: Scalar

impl<N> Sync for PhysicsColliderBuilder<N> where
    N: Scalar

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<T> Downcast for T where
    T: Any

impl<T> Event for T where
    T: Send + Sync + 'static, 
[src]

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T> Any for T where
    T: Any

impl<T> Erased for T