Skip to main content

b3WorldDef

Struct b3WorldDef 

Source
#[repr(C)]
pub struct b3WorldDef {
Show 21 fields pub gravity: b3Vec3, pub restitutionThreshold: f32, pub hitEventThreshold: f32, pub contactHertz: f32, pub contactDampingRatio: f32, pub contactSpeed: f32, pub maximumLinearSpeed: f32, pub frictionCallback: b3FrictionCallback, pub restitutionCallback: b3RestitutionCallback, pub enableSleep: bool, pub enableContinuous: bool, pub workerCount: u32, pub enqueueTask: b3EnqueueTaskCallback, pub finishTask: b3FinishTaskCallback, pub userTaskContext: *mut c_void, pub userData: *mut c_void, pub createDebugShape: b3CreateDebugShapeCallback, pub destroyDebugShape: b3DestroyDebugShapeCallback, pub userDebugShapeContext: *mut c_void, pub capacity: b3Capacity, pub internalValue: c_int,
}
Expand description

World definition used to create a simulation world. Must be initialized using b3DefaultWorldDef. @ingroup world

Fields§

§gravity: b3Vec3

Gravity vector. Box3D 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

Hit event speed threshold, usually in m/s. Collisions above this speed can generate hit events if the shape also enables hit events.

§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: b3FrictionCallback

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

§restitutionCallback: b3RestitutionCallback

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

§workerCount: u32

Number of workers to use with the provided task system. Box3D 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. This is clamped to the range [1, B3_MAX_WORKERS]. Using a value above 1 will turn on multithreading. If task callbacks are provided then Box3D will use the user provided task system. Otherwise Box3D will create threads and use an internal scheduler.

§enqueueTask: b3EnqueueTaskCallback

function to spawn task

§finishTask: b3FinishTaskCallback

function to finish a task

§userTaskContext: *mut c_void

User context that is provided to enqueueTask and finishTask

§userData: *mut c_void

User data associated with a world

§createDebugShape: b3CreateDebugShapeCallback

Used to create debug draw shapes. This is called when a shape is first drawn using b3DebugDraw.

§destroyDebugShape: b3DestroyDebugShapeCallback

Used to destroy debug draw shapes. This is called when a shape is modified or destroyed.

§userDebugShapeContext: *mut c_void

This is passed to the debug shape callbacks to provide a user context.

§capacity: b3Capacity

Optional initial capacities

§internalValue: c_int

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

Trait Implementations§

Source§

impl Clone for b3WorldDef

Source§

fn clone(&self) -> b3WorldDef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for b3WorldDef

Source§

impl Debug for b3WorldDef

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

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

Source§

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.