[][src]Struct specs_physics::bodies::PhysicsBodyBuilder

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

The PhysicsBodyBuilder implements the builder pattern for PhysicsBodys and is the recommended way of instantiating and customising new PhysicsBody instances.

Example

use specs_physics::{
    nalgebra::{Matrix3, Point3},
    nphysics::{algebra::Velocity3, object::BodyStatus},
    PhysicsBodyBuilder,
};

let physics_body = PhysicsBodyBuilder::from(BodyStatus::Dynamic)
    .gravity_enabled(true)
    .velocity(Velocity3::linear(1.0, 1.0, 1.0))
    .angular_inertia(Matrix3::from_diagonal_element(3.0))
    .mass(1.3)
    .local_center_of_mass(Point3::new(0.0, 0.0, 0.0))
    .build();

Methods

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

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

Sets the gravity_enabled value of the PhysicsBodyBuilder.

pub fn velocity(self, velocity: Velocity3<N>) -> Self[src]

pub fn angular_inertia(self, angular_inertia: Matrix3<N>) -> Self[src]

Sets the angular_inertia value of the PhysicsBodyBuilder.

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

Sets the mass value of the PhysicsBodyBuilder.

pub fn local_center_of_mass(self, local_center_of_mass: Point3<N>) -> Self[src]

Sets the local_center_of_mass value of the PhysicsBodyBuilder.

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

Builds the PhysicsBody from the values set in the PhysicsBodyBuilder instance.

Trait Implementations

impl<N: RealField> From<BodyStatus> for PhysicsBodyBuilder<N>[src]

fn from(body_status: BodyStatus) -> Self[src]

Creates a new PhysicsBodyBuilder from the given BodyStatus. This also populates the PhysicsBody with sane defaults.

Auto Trait Implementations

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

impl<N> Sync for PhysicsBodyBuilder<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