pub struct WorldBuilder { /* private fields */ }Expand description
Fluent builder for WorldDef.
Chain configuration calls and finish with build(). All fields map 1:1 to
the upstream b2WorldDef.
Implementations§
Source§impl WorldBuilder
impl WorldBuilder
Sourcepub fn gravity<V: Into<Vec2>>(self, g: V) -> Self
pub fn gravity<V: Into<Vec2>>(self, g: V) -> Self
Set gravity vector in meters per second squared.
Sourcepub fn restitution_threshold(self, v: f32) -> Self
pub fn restitution_threshold(self, v: f32) -> Self
Restitution threshold (m/s) under which collisions don’t bounce.
Sourcepub fn hit_event_threshold(self, v: f32) -> Self
pub fn hit_event_threshold(self, v: f32) -> Self
Impulse magnitude that generates hit events.
Sourcepub fn contact_hertz(self, v: f32) -> Self
pub fn contact_hertz(self, v: f32) -> Self
Contact solver target stiffness in Hertz.
Sourcepub fn contact_damping_ratio(self, v: f32) -> Self
pub fn contact_damping_ratio(self, v: f32) -> Self
Contact damping ratio (non-dimensional).
Sourcepub fn contact_speed(self, v: f32) -> Self
pub fn contact_speed(self, v: f32) -> Self
Velocity used by continuous collision detection.
Sourcepub fn maximum_linear_speed(self, v: f32) -> Self
pub fn maximum_linear_speed(self, v: f32) -> Self
Maximum linear speed clamp for bodies.
Sourcepub fn enable_sleep(self, flag: bool) -> Self
pub fn enable_sleep(self, flag: bool) -> Self
Enable/disable sleeping globally.
Sourcepub fn enable_continuous(self, flag: bool) -> Self
pub fn enable_continuous(self, flag: bool) -> Self
Enable/disable continuous collision detection globally.
Sourcepub fn enable_contact_softening(self, flag: bool) -> Self
pub fn enable_contact_softening(self, flag: bool) -> Self
Enable/disable contact softening.
Sourcepub fn worker_count(self, n: i32) -> Self
pub fn worker_count(self, n: i32) -> Self
Number of worker threads Box2D may use.
pub fn build(self) -> WorldDef
Trait Implementations§
Source§impl Clone for WorldBuilder
impl Clone for WorldBuilder
Source§fn clone(&self) -> WorldBuilder
fn clone(&self) -> WorldBuilder
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorldBuilder
impl Debug for WorldBuilder
Auto Trait Implementations§
impl Freeze for WorldBuilder
impl RefUnwindSafe for WorldBuilder
impl !Send for WorldBuilder
impl !Sync for WorldBuilder
impl Unpin for WorldBuilder
impl UnwindSafe for WorldBuilder
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
Mutably borrows from an owned value. Read more
§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)
🔬This is a nightly-only experimental API. (
clone_to_uninit)