Struct rhusics_ecs::BasicCollisionSystem
source · pub struct BasicCollisionSystem<P, T, D, B, Y = ()>where
P: Primitive,
B: Bound,{ /* private fields */ }
Expand description
Collision detection system for use with
specs
.
Has support for both broad phase and narrow phase collision detection. Will only do narrow phase if both broad and narrow phase is activated.
Can handle any transform component type, as long as the type implements
Transform
, and as long as the
storage is wrapped in a
FlaggedStorage
.
Type parameters:
P
: Shape primitiveT
: TransformD
: Data accepted by broad phaseB
: Bounding volumeY
: Shape type, seeCollider
System Function:
fn(Entities, T, NextFrame<T>, CollisionShape) -> (CollisionShape, EventChannel<ContactEvent>)
Implementations
sourceimpl<P, T, D, B, Y> BasicCollisionSystem<P, T, D, B, Y>where
P: Primitive + ComputeBound<B> + Send + Sync + 'static,
P::Point: Debug + Send + Sync + 'static,
<P::Point as EuclideanSpace>::Scalar: Send + Sync + 'static,
<P::Point as EuclideanSpace>::Diff: Debug + Send + Sync + 'static,
T: Component + Transform<P::Point> + Send + Sync + Clone + 'static,
Y: Default + Send + Sync + 'static,
B: Bound<Point = P::Point> + Send + Sync + 'static + Union<B, Output = B> + Clone,
D: HasBound<Bound = B> + From<(Entity, B)> + GetId<Entity>,
impl<P, T, D, B, Y> BasicCollisionSystem<P, T, D, B, Y>where
P: Primitive + ComputeBound<B> + Send + Sync + 'static,
P::Point: Debug + Send + Sync + 'static,
<P::Point as EuclideanSpace>::Scalar: Send + Sync + 'static,
<P::Point as EuclideanSpace>::Diff: Debug + Send + Sync + 'static,
T: Component + Transform<P::Point> + Send + Sync + Clone + 'static,
Y: Default + Send + Sync + 'static,
B: Bound<Point = P::Point> + Send + Sync + 'static + Union<B, Output = B> + Clone,
D: HasBound<Bound = B> + From<(Entity, B)> + GetId<Entity>,
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new collision detection system, with no broad or narrow phase activated.
sourcepub fn with_narrow_phase<N: NarrowPhase<P, T, B, Y> + 'static>(
self,
narrow: N
) -> Self
pub fn with_narrow_phase<N: NarrowPhase<P, T, B, Y> + 'static>(
self,
narrow: N
) -> Self
Specify what narrow phase algorithm to use
sourcepub fn with_broad_phase<V: BroadPhase<D> + 'static>(self, broad: V) -> Self
pub fn with_broad_phase<V: BroadPhase<D> + 'static>(self, broad: V) -> Self
Specify what broad phase algorithm to use
Trait Implementations
sourceimpl<'a, P, T, Y, D, B> System<'a> for BasicCollisionSystem<P, T, D, B, Y>where
P: Primitive + ComputeBound<B> + Send + Sync + 'static,
P::Point: Debug + Send + Sync + 'static,
<P::Point as EuclideanSpace>::Scalar: Send + Sync + 'static,
<P::Point as EuclideanSpace>::Diff: Debug + Send + Sync + 'static,
T: Component + Transform<P::Point> + Send + Sync + Clone + 'static,
Y: Default + Send + Sync + 'static,
B: Bound<Point = P::Point> + Send + Sync + 'static + Union<B, Output = B> + Clone,
D: HasBound<Bound = B> + From<(Entity, B)> + GetId<Entity>,
impl<'a, P, T, Y, D, B> System<'a> for BasicCollisionSystem<P, T, D, B, Y>where
P: Primitive + ComputeBound<B> + Send + Sync + 'static,
P::Point: Debug + Send + Sync + 'static,
<P::Point as EuclideanSpace>::Scalar: Send + Sync + 'static,
<P::Point as EuclideanSpace>::Diff: Debug + Send + Sync + 'static,
T: Component + Transform<P::Point> + Send + Sync + Clone + 'static,
Y: Default + Send + Sync + 'static,
B: Bound<Point = P::Point> + Send + Sync + 'static + Union<B, Output = B> + Clone,
D: HasBound<Bound = B> + From<(Entity, B)> + GetId<Entity>,
type SystemData = (Read<'a, EntitiesRes, DefaultProvider>, Storage<'a, T, Fetch<'a, MaskedStorage<T>>>, Storage<'a, NextFrame<T>, Fetch<'a, MaskedStorage<NextFrame<T>>>>, Storage<'a, CollisionShape<P, T, B, Y>, FetchMut<'a, MaskedStorage<CollisionShape<P, T, B, Y>>>>, Write<'a, EventChannel<ContactEvent<Entity, <P as Primitive>::Point>>, DefaultProvider>)
type SystemData = (Read<'a, EntitiesRes, DefaultProvider>, Storage<'a, T, Fetch<'a, MaskedStorage<T>>>, Storage<'a, NextFrame<T>, Fetch<'a, MaskedStorage<NextFrame<T>>>>, Storage<'a, CollisionShape<P, T, B, Y>, FetchMut<'a, MaskedStorage<CollisionShape<P, T, B, Y>>>>, Write<'a, EventChannel<ContactEvent<Entity, <P as Primitive>::Point>>, DefaultProvider>)
The resource bundle required to execute this system. Read more
sourcefn run(&mut self, system_data: Self::SystemData)
fn run(&mut self, system_data: Self::SystemData)
Executes the system with the required system
data. Read more
sourcefn running_time(&self) -> RunningTime
fn running_time(&self) -> RunningTime
Returns a hint how long the system needs for running.
This is used to optimize the way they’re executed (might
allow more parallelization). Read more
sourcefn accessor<'b>(&'b self) -> AccessorCow<'a, 'b, Self>
fn accessor<'b>(&'b self) -> AccessorCow<'a, 'b, Self>
Return the accessor from the
SystemData
.Auto Trait Implementations
impl<P, T, D, B, Y = ()> !RefUnwindSafe for BasicCollisionSystem<P, T, D, B, Y>
impl<P, T, D, B, Y> Send for BasicCollisionSystem<P, T, D, B, Y>
impl<P, T, D, B, Y = ()> !Sync for BasicCollisionSystem<P, T, D, B, Y>
impl<P, T, D, B, Y> Unpin for BasicCollisionSystem<P, T, D, B, Y>
impl<P, T, D, B, Y = ()> !UnwindSafe for BasicCollisionSystem<P, T, D, B, Y>
Blanket Implementations
impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<'a, T> RunWithPool<'a> for Twhere
T: System<'a>,
impl<'a, T> RunWithPool<'a> for Twhere
T: System<'a>,
sourcefn run(&mut self, res: &'a Resources, _: &ThreadPool)
fn run(&mut self, res: &'a Resources, _: &ThreadPool)
Runs the system/group of systems. Possibly in parallel depending
on how the structure is set up. Read more