#[repr(C)]
pub struct b2BodyDef {
Show 14 fields pub type_: b2BodyType, pub position: b2Vec2, pub angle: f32, pub linearVelocity: b2Vec2, pub angularVelocity: f32, pub linearDamping: f32, pub angularDamping: f32, pub allowSleep: bool, pub awake: bool, pub fixedRotation: bool, pub bullet: bool, pub enabled: bool, pub userData: b2BodyUserData, pub gravityScale: f32,
}
Expand description

A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction.

Fields§

§type_: b2BodyType

The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.

§position: b2Vec2

The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.

§angle: f32

The world angle of the body in radians.

§linearVelocity: b2Vec2

The linear velocity of the body’s origin in world co-ordinates.

§angularVelocity: f32

The angular velocity of the body.

§linearDamping: f32

Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large. Units are 1/time

§angularDamping: f32

Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large. Units are 1/time

§allowSleep: bool

Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.

§awake: bool

Is this body initially awake or sleeping?

§fixedRotation: bool

Should this body be prevented from rotating? Useful for characters.

§bullet: bool

Is this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies. @warning You should use this flag sparingly since it increases processing time.

§enabled: bool

Does this body start out enabled?

§userData: b2BodyUserData

Use this to store application specific body data.

§gravityScale: f32

Scale the gravity applied to this body.

Implementations§

source§

impl b2BodyDef

source

pub fn new() -> impl New<Output = Self>

This constructor sets the body definition default values.

Trait Implementations§

source§

impl CopyNew for b2BodyDef

source§

unsafe fn copy_new(other: &b2BodyDef, this: Pin<&mut MaybeUninit<b2BodyDef>>)

Synthesized copy constructor.

source§

impl Drop for b2BodyDef

source§

fn drop(self: &mut b2BodyDef)

Synthesized destructor.

source§

impl ExternType for b2BodyDef

§

type Id = (b, _2, B, o, d, y, D, e, f)

A type-level representation of the type’s C++ namespace and type name. Read more
§

type Kind = Trivial

source§

impl MakeCppStorage for b2BodyDef

source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut b2BodyDef

Allocates heap space for this type in C++ and return a pointer to that space, but do not initialize that space (i.e. do not yet call a constructor). Read more
source§

unsafe fn free_uninitialized_cpp_storage(arg0: *mut b2BodyDef)

Frees a C++ allocation which has not yet had a constructor called. Read more
source§

impl MoveNew for b2BodyDef

source§

unsafe fn move_new( other: Pin<MoveRef<'_, b2BodyDef>>, this: Pin<&mut MaybeUninit<b2BodyDef>> )

Synthesized move constructor.

source§

impl SharedPtrTarget for b2BodyDef

source§

impl UniquePtrTarget for b2BodyDef

source§

impl VectorElement for b2BodyDef

source§

impl WeakPtrTarget for b2BodyDef

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
source§

impl<T> WithinBoxTrivial for Twhere T: ExternType<Kind = Trivial> + Unpin,

source§

fn within_box(self) -> Pin<Box<T>>

source§

impl<T> WithinUniquePtrTrivial for Twhere T: UniquePtrTarget + ExternType<Kind = Trivial> + Unpin,