pub struct WorldDef {Show 16 fields
pub gravity: Vec2,
pub restitution_threshold: f32,
pub hit_event_threshold: f32,
pub contact_hertz: f32,
pub contact_damping_ratio: f32,
pub contact_speed: f32,
pub maximum_linear_speed: f32,
pub friction_callback: Option<FrictionCallback>,
pub restitution_callback: Option<RestitutionCallback>,
pub enable_sleep: bool,
pub enable_continuous: bool,
pub enable_contact_softening: bool,
pub worker_count: i32,
pub user_data: u64,
pub capacity: Capacity,
pub internal_value: i32,
}Expand description
World definition used to create a simulation world. Must be initialized
using default_world_def. (b2WorldDef)
PartialEq is intentionally not derived: it holds optional function-pointer
callbacks, and function-pointer equality is not meaningful.
Fields§
§gravity: Vec2Gravity vector. Box2D has no up-vector defined.
restitution_threshold: f32Restitution speed threshold, usually in m/s. Collisions above this speed have restitution applied (will bounce).
hit_event_threshold: f32Threshold speed for hit events. Usually meters per second.
contact_hertz: f32Contact stiffness. Cycles per second.
contact_damping_ratio: f32Contact bounciness. Non-dimensional.
contact_speed: f32Speed cap on overlap resolution, usually meters per second.
maximum_linear_speed: f32Maximum linear speed. Usually meters per second.
friction_callback: Option<FrictionCallback>Optional mixing callback for friction.
restitution_callback: Option<RestitutionCallback>Optional mixing callback for restitution.
enable_sleep: boolCan bodies go to sleep to improve performance.
enable_continuous: boolEnable continuous collision.
enable_contact_softening: boolContact softening when mass ratios are large. Experimental.
worker_count: i32Number of workers for multithreading, clamped to [1, MAX_WORKERS].
user_data: u64User data.
capacity: CapacityOptional initial capacities.
internal_value: i32Used internally to detect a valid definition. DO NOT SET.