#[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: b2Vec2Gravity vector. Box2D has no up-vector defined.
restitutionThreshold: f32Restitution speed threshold, usually in m/s. Collisions above this speed have restitution applied (will bounce).
hitEventThreshold: f32Threshold speed for hit events. Usually meters per second.
contactHertz: f32Contact stiffness. Cycles per second. Increasing this increases the speed of overlap recovery, but can introduce jitter.
contactDampingRatio: f32Contact bounciness. Non-dimensional. You can speed up overlap recovery by decreasing this with the trade-off that overlap resolution becomes more energetic.
contactSpeed: f32This 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: f32Maximum linear speed. Usually meters per second.
frictionCallback: b2FrictionCallbackOptional mixing callback for friction. The default uses sqrt(frictionA * frictionB).
restitutionCallback: b2RestitutionCallbackOptional mixing callback for restitution. The default uses max(restitutionA, restitutionB).
enableSleep: boolCan bodies go to sleep to improve performance
enableContinuous: boolEnable continuous collision
enableContactSoftening: boolContact softening when mass ratios are large. Experimental.
workerCount: c_intNumber 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: b2EnqueueTaskCallbackFunction to spawn tasks
finishTask: b2FinishTaskCallbackFunction to finish a task
userTaskContext: *mut c_voidUser context that is provided to enqueueTask and finishTask
userData: *mut c_voidUser data
internalValue: c_intUsed internally to detect a valid definition. DO NOT SET.
Trait Implementations§
Source§impl Clone for b2WorldDef
impl Clone for b2WorldDef
Source§fn clone(&self) -> b2WorldDef
fn clone(&self) -> b2WorldDef
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for b2WorldDef
impl Debug for b2WorldDef
impl Copy for b2WorldDef
Auto Trait Implementations§
impl Freeze for b2WorldDef
impl RefUnwindSafe for b2WorldDef
impl !Send for b2WorldDef
impl !Sync for b2WorldDef
impl Unpin for b2WorldDef
impl UnwindSafe for b2WorldDef
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)