b2ShapeDef

Struct b2ShapeDef 

Source
#[repr(C)]
pub struct b2ShapeDef {
Show 13 fields pub userData: *mut c_void, pub material: b2SurfaceMaterial, pub density: f32, pub filter: b2Filter, pub enableCustomFiltering: bool, pub isSensor: bool, pub enableSensorEvents: bool, pub enableContactEvents: bool, pub enableHitEvents: bool, pub enablePreSolveEvents: bool, pub invokeContactCreation: bool, pub updateBodyMass: bool, pub internalValue: c_int,
}
Expand description

Used to create a shape. This is a temporary object used to bundle shape creation parameters. You may use the same shape definition to create multiple shapes. Must be initialized using b2DefaultShapeDef(). @ingroup shape

Fields§

§userData: *mut c_void

Use this to store application specific shape data.

§material: b2SurfaceMaterial

The surface material for this shape.

§density: f32

The density, usually in kg/m^2. This is not part of the surface material because this is for the interior, which may have other considerations, such as being hollow. For example a wood barrel may be hollow or full of water.

§filter: b2Filter

Collision filtering data.

§enableCustomFiltering: bool

Enable custom filtering. Only one of the two shapes needs to enable custom filtering. See b2WorldDef.

§isSensor: bool

A sensor shape generates overlap events but never generates a collision response. Sensors do not have continuous collision. Instead, use a ray or shape cast for those scenarios. Sensors still contribute to the body mass if they have non-zero density. @note Sensor events are disabled by default. @see enableSensorEvents

§enableSensorEvents: bool

Enable sensor events for this shape. This applies to sensors and non-sensors. False by default, even for sensors.

§enableContactEvents: bool

Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default.

§enableHitEvents: bool

Enable hit events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default.

§enablePreSolveEvents: bool

Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to multithreading. Ignored for sensors.

§invokeContactCreation: bool

When shapes are created they will scan the environment for collision the next time step. This can significantly slow down static body creation when there are many static shapes. This is flag is ignored for dynamic and kinematic shapes which always invoke contact creation.

§updateBodyMass: bool

Should the body update the mass properties when this shape is created. Default is true. Warning: if this is true, you MUST call b2Body_ApplyMassFromShapes before simulating the world.

§internalValue: c_int

Used internally to detect a valid definition. DO NOT SET.

Trait Implementations§

Source§

impl Clone for b2ShapeDef

Source§

fn clone(&self) -> b2ShapeDef

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for b2ShapeDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for b2ShapeDef

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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

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

Performs the conversion.