pub struct GridParticleCollision {
pub cell_size: f32,
pub particle_radius: f32,
pub restitution: f32,
}Expand description
GPU-style particle collision using a grid-based broad phase.
Assigns each particle to a grid cell, then checks only neighbours.
Fields§
§cell_size: f32Cell size.
particle_radius: f32Radius for collision detection.
restitution: f32Restitution coefficient.
Implementations§
Source§impl GridParticleCollision
impl GridParticleCollision
Sourcepub fn new(cell_size: f32, particle_radius: f32, restitution: f32) -> Self
pub fn new(cell_size: f32, particle_radius: f32, restitution: f32) -> Self
Create a new grid collision handler.
Sourcepub fn resolve(&self, buffer: &mut ParticleBuffer)
pub fn resolve(&self, buffer: &mut ParticleBuffer)
Resolve collisions between all alive particles (O(n) with grid).
Uses a simple hash-grid approach: build cell lists, then check same-cell and adjacent-cell pairs only.
Auto Trait Implementations§
impl Freeze for GridParticleCollision
impl RefUnwindSafe for GridParticleCollision
impl Send for GridParticleCollision
impl Sync for GridParticleCollision
impl Unpin for GridParticleCollision
impl UnsafeUnpin for GridParticleCollision
impl UnwindSafe for GridParticleCollision
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more