[−][src]Struct specs_physics::body::PhysicsBodyBuilder
The PhysicsBodyBuilder
implements the builder pattern for PhysicsBody
s
and is the recommended way of instantiating and customising new
PhysicsBody
instances.
Example
use specs_physics::{ body::BodyStatus, math::{Matrix3, Point3, Vector3}, PhysicsBodyBuilder, }; let physics_body = PhysicsBodyBuilder::from(BodyStatus::Dynamic) .gravity_enabled(true) .velocity(Vector3::new(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: Vector3<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,
N: Scalar,
impl<N> Sync for PhysicsBodyBuilder<N> where
N: Scalar,
N: Scalar,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> Resource for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> Any for T where
T: Any,
T: Any,
fn get_type_id(&self) -> TypeId
impl<T> Event for T where
T: Send + Sync + 'static,
T: Send + Sync + 'static,