b2WorldDef

Struct b2WorldDef 

Source
#[repr(C)]
pub struct b2WorldDef {
Show 18 fields pub gravity: b2Vec2, pub restitutionThreshold: f32, pub hitEventThreshold: f32, pub contactHertz: f32, pub contactDampingRatio: f32, pub contactSpeed: f32, pub maximumLinearSpeed: f32, pub frictionCallback: b2FrictionCallback, pub restitutionCallback: b2RestitutionCallback, pub enableSleep: bool, pub enableContinuous: bool, pub enableContactSoftening: bool, pub workerCount: c_int, pub enqueueTask: b2EnqueueTaskCallback, pub finishTask: b2FinishTaskCallback, pub userTaskContext: *mut c_void, pub userData: *mut c_void, pub internalValue: c_int,
}
Expand description

World definition used to create a simulation world. Must be initialized using b2DefaultWorldDef(). @ingroup world

Fields§

§gravity: b2Vec2

Gravity vector. Box2D has no up-vector defined.

§restitutionThreshold: f32

Restitution speed threshold, usually in m/s. Collisions above this speed have restitution applied (will bounce).

§hitEventThreshold: f32

Threshold speed for hit events. Usually meters per second.

§contactHertz: f32

Contact stiffness. Cycles per second. Increasing this increases the speed of overlap recovery, but can introduce jitter.

§contactDampingRatio: f32

Contact bounciness. Non-dimensional. You can speed up overlap recovery by decreasing this with the trade-off that overlap resolution becomes more energetic.

§contactSpeed: f32

This parameter controls how fast overlap is resolved and usually has units of meters per second. This only puts a cap on the resolution speed. The resolution speed is increased by increasing the hertz and/or decreasing the damping ratio.

§maximumLinearSpeed: f32

Maximum linear speed. Usually meters per second.

§frictionCallback: b2FrictionCallback

Optional mixing callback for friction. The default uses sqrt(frictionA * frictionB).

§restitutionCallback: b2RestitutionCallback

Optional mixing callback for restitution. The default uses max(restitutionA, restitutionB).

§enableSleep: bool

Can bodies go to sleep to improve performance

§enableContinuous: bool

Enable continuous collision

§enableContactSoftening: bool

Contact softening when mass ratios are large. Experimental.

§workerCount: c_int

Number of workers to use with the provided task system. Box2D performs best when using only performance cores and accessing a single L2 cache. Efficiency cores and hyper-threading provide little benefit and may even harm performance. @note Box2D does not create threads. This is the number of threads your applications has created that you are allocating to b2World_Step. @warning Do not modify the default value unless you are also providing a task system and providing task callbacks (enqueueTask and finishTask).

§enqueueTask: b2EnqueueTaskCallback

Function to spawn tasks

§finishTask: b2FinishTaskCallback

Function to finish a task

§userTaskContext: *mut c_void

User context that is provided to enqueueTask and finishTask

§userData: *mut c_void

User data

§internalValue: c_int

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

Trait Implementations§

Source§

impl Clone for b2WorldDef

Source§

fn clone(&self) -> b2WorldDef

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 b2WorldDef

Source§

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

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

impl Copy for b2WorldDef

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.