pub struct PhysicsWorld2D { /* private fields */ }Expand description
The physics world managing all rigid bodies and simulation steps.
Implementations§
Source§impl PhysicsWorld2D
Implements body management and simulation for PhysicsWorld2D.
impl PhysicsWorld2D
Implements body management and simulation for PhysicsWorld2D.
Sourcepub fn with_config(config: PhysicsConfig) -> PhysicsWorld2D
pub fn with_config(config: PhysicsConfig) -> PhysicsWorld2D
Sourcepub fn add_body(&mut self, body: RigidBody2D)
pub fn add_body(&mut self, body: RigidBody2D)
Sourcepub fn remove_body(&mut self, id: u64)
pub fn remove_body(&mut self, id: u64)
Sourcepub fn get_body(&self, id: u64) -> Option<&RigidBody2D>
pub fn get_body(&self, id: u64) -> Option<&RigidBody2D>
Sourcepub fn get_body_mut(&mut self, id: u64) -> Option<&mut RigidBody2D>
pub fn get_body_mut(&mut self, id: u64) -> Option<&mut RigidBody2D>
Source§impl PhysicsWorld2D
Implements simulation stepping and collision resolution for PhysicsWorld2D.
impl PhysicsWorld2D
Implements simulation stepping and collision resolution for PhysicsWorld2D.
Sourcepub fn step(&mut self, delta_time: f64)
pub fn step(&mut self, delta_time: f64)
Performs one physics simulation step using semi-implicit Euler integration.
Applies gravity to dynamic bodies, integrates velocity from accumulated forces, applies damping, integrates position, and resolves collisions.
§Arguments
f64- The fixed delta time in seconds.
Source§impl PhysicsWorld2D
impl PhysicsWorld2D
pub fn get_config(&self) -> PhysicsConfig
pub fn get_mut_config(&mut self) -> &mut PhysicsConfig
pub fn set_config(&mut self, val: PhysicsConfig) -> &mut Self
pub fn get_grid(&self) -> &SpatialHashGrid2D
pub fn get_query_buffer(&self) -> &Vec<usize>
pub fn set_query_buffer(&mut self, val: Vec<usize>) -> &mut Self
pub fn get_query_seen(&self) -> &HashSet<usize>
pub fn set_query_seen(&mut self, val: HashSet<usize>) -> &mut Self
pub fn get_pair_buffer(&self) -> &Vec<(usize, usize)>
pub fn set_pair_buffer(&mut self, val: Vec<(usize, usize)>) -> &mut Self
Source§impl PhysicsWorld2D
impl PhysicsWorld2D
pub fn new(config: PhysicsConfig) -> Self
Trait Implementations§
Source§impl Clone for PhysicsWorld2D
impl Clone for PhysicsWorld2D
Source§fn clone(&self) -> PhysicsWorld2D
fn clone(&self) -> PhysicsWorld2D
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PhysicsWorld2D
impl Debug for PhysicsWorld2D
Source§impl Default for PhysicsWorld2D
Implements Default for PhysicsWorld2D as an empty world.
impl Default for PhysicsWorld2D
Implements Default for PhysicsWorld2D as an empty world.
Source§fn default() -> PhysicsWorld2D
fn default() -> PhysicsWorld2D
Source§impl PartialEq for PhysicsWorld2D
impl PartialEq for PhysicsWorld2D
impl StructuralPartialEq for PhysicsWorld2D
Source§impl Updatable for PhysicsWorld2D
Forwards PhysicsWorld2D::step through the Updatable trait so that
physics worlds participate in the same update loop as entities, animators,
and scene managers. The inherent PhysicsWorld2D::step method is the
canonical implementation; this impl exists purely for trait dispatch.
The inherent call resolves first when both are in scope, so there is no
recursion.
impl Updatable for PhysicsWorld2D
Forwards PhysicsWorld2D::step through the Updatable trait so that
physics worlds participate in the same update loop as entities, animators,
and scene managers. The inherent PhysicsWorld2D::step method is the
canonical implementation; this impl exists purely for trait dispatch.
The inherent call resolves first when both are in scope, so there is no
recursion.