#[repr(C)]pub struct b2WorldDef {Show 19 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 capacity: b2Capacity,
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 for multithreading. Box2D performs best when using performance cores and accessing a single L3 cache (uniform memory). Efficiency cores and SMT provide little benefit and may even harm performance. This is clamped to the range [1, B2_MAX_WORKERS]. Using a value above 1 will turn on multithreading. If task callbacks are provided then Box2D will use the user provided task system. Otherwise Box2D will create threads and use an internal scheduler.
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
capacity: b2CapacityOptional initial capacities
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more