pub struct ParticleCollider {
pub plane_point: [f32; 3],
pub plane_normal: [f32; 3],
pub restitution: f32,
pub friction: f32,
}Expand description
Particle-plane collision with restitution coefficient.
The plane is defined by a point and a normal (pointing into the “safe” side).
Fields§
§plane_point: [f32; 3]A point on the plane.
plane_normal: [f32; 3]Outward unit normal of the plane.
restitution: f32Coefficient of restitution [0, 1]. 0 = inelastic, 1 = elastic.
friction: f32Friction coefficient applied to tangential velocity on collision.
Implementations§
Source§impl ParticleCollider
impl ParticleCollider
Sourcepub fn floor(y: f32, restitution: f32) -> Self
pub fn floor(y: f32, restitution: f32) -> Self
Create a horizontal floor at height y with given restitution.
Sourcepub fn new(
plane_point: [f32; 3],
plane_normal: [f32; 3],
restitution: f32,
) -> Self
pub fn new( plane_point: [f32; 3], plane_normal: [f32; 3], restitution: f32, ) -> Self
Create a collider for a general plane.
Sourcepub fn resolve(&self, particle: &mut GpuParticle)
pub fn resolve(&self, particle: &mut GpuParticle)
Resolve collision for one particle (modifies position and velocity).
Sourcepub fn resolve_all(&self, particles: &mut [GpuParticle])
pub fn resolve_all(&self, particles: &mut [GpuParticle])
Resolve collisions for all alive particles.
Trait Implementations§
Source§impl Clone for ParticleCollider
impl Clone for ParticleCollider
Source§fn clone(&self) -> ParticleCollider
fn clone(&self) -> ParticleCollider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParticleCollider
impl Debug for ParticleCollider
impl Copy for ParticleCollider
Auto Trait Implementations§
impl Freeze for ParticleCollider
impl RefUnwindSafe for ParticleCollider
impl Send for ParticleCollider
impl Sync for ParticleCollider
impl Unpin for ParticleCollider
impl UnsafeUnpin for ParticleCollider
impl UnwindSafe for ParticleCollider
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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