Struct rhusics_ecs::SpatialCollisionSystem [−][src]
pub struct SpatialCollisionSystem<P, T, D, B, Y = ()> where
P: Primitive,
B: Bound, { /* fields omitted */ }
Collision detection system for use with
specs
.
Will perform spatial sorting of the collision world.
Has support for both broad phase and narrow phase collision detection. Will only do narrow phase if both broad and narrow phase is activated. If no broad phase is set, it will use a DBVT based broad phase that has complexity O(m log^2 n), where m is the number of shapes that have a dirty pose.
Can handle any transform component type, as long as the type implements
Transform
, and as long as the
storage is wrapped in
FlaggedStorage
.
Type parameters:
P
: Shape primitiveT
: TransformD
: Data accepted by broad phaseY
: Shape type, seeCollider
System Function:
fn(Entities, T, NextFrame<T>, CollisionShape, DynamicBoundingVolumeTree<D>) -> (DynamicBoundingVolumeTree<D>, EventChannel<ContactEvent>)
Methods
impl<P, T, D, B, Y> SpatialCollisionSystem<P, T, D, B, Y> where
P: Primitive + Send + Sync + 'static,
<P::Point as EuclideanSpace>::Diff: Debug,
<P::Point as EuclideanSpace>::Scalar: BaseFloat,
B: Clone + Debug + Send + Sync + 'static + Bound<Point = P::Point> + Union<B, Output = B> + Contains<B> + SurfaceArea<Scalar = <P::Point as EuclideanSpace>::Scalar>,
T: Transform<P::Point> + Component,
D: HasBound<Bound = B>,
[src]
impl<P, T, D, B, Y> SpatialCollisionSystem<P, T, D, B, Y> where
P: Primitive + Send + Sync + 'static,
<P::Point as EuclideanSpace>::Diff: Debug,
<P::Point as EuclideanSpace>::Scalar: BaseFloat,
B: Clone + Debug + Send + Sync + 'static + Bound<Point = P::Point> + Union<B, Output = B> + Contains<B> + SurfaceArea<Scalar = <P::Point as EuclideanSpace>::Scalar>,
T: Transform<P::Point> + Component,
D: HasBound<Bound = B>,
pub fn new() -> Self
[src]
pub fn new() -> Self
Create a new collision detection system, with no broad or narrow phase activated.
pub fn with_narrow_phase<N: NarrowPhase<P, T, B, Y> + 'static>(
self,
narrow: N
) -> Self
[src]
pub fn with_narrow_phase<N: NarrowPhase<P, T, B, Y> + 'static>(
self,
narrow: N
) -> Self
Specify what narrow phase algorithm to use
pub fn with_broad_phase<V: BroadPhase<D> + 'static>(self, broad: V) -> Self
[src]
pub fn with_broad_phase<V: BroadPhase<D> + 'static>(self, broad: V) -> Self
Specify what broad phase algorithm to use
Trait Implementations
impl<'a, P, T, Y, B, D> System<'a> for SpatialCollisionSystem<P, T, (usize, D), B, Y> where
P: Primitive + ComputeBound<B> + Send + Sync + 'static,
P::Point: EuclideanSpace,
<P::Point as EuclideanSpace>::Scalar: BaseFloat + Send + Sync + 'static,
B: Clone + Debug + Send + Sync + 'static + Bound<Point = P::Point> + Union<B, Output = B> + Discrete<B> + Contains<B> + SurfaceArea<Scalar = <P::Point as EuclideanSpace>::Scalar>,
<P::Point as EuclideanSpace>::Diff: Debug + Send + Sync + 'static,
P::Point: Debug + Send + Sync + 'static,
T: Component + Clone + Debug + Transform<P::Point> + Send + Sync + 'static,
T::Storage: Tracked,
Y: Default + Send + Sync + 'static,
D: Send + Sync + 'static + TreeValue<Bound = B> + HasBound<Bound = B> + GetId<Entity>,
[src]
impl<'a, P, T, Y, B, D> System<'a> for SpatialCollisionSystem<P, T, (usize, D), B, Y> where
P: Primitive + ComputeBound<B> + Send + Sync + 'static,
P::Point: EuclideanSpace,
<P::Point as EuclideanSpace>::Scalar: BaseFloat + Send + Sync + 'static,
B: Clone + Debug + Send + Sync + 'static + Bound<Point = P::Point> + Union<B, Output = B> + Discrete<B> + Contains<B> + SurfaceArea<Scalar = <P::Point as EuclideanSpace>::Scalar>,
<P::Point as EuclideanSpace>::Diff: Debug + Send + Sync + 'static,
P::Point: Debug + Send + Sync + 'static,
T: Component + Clone + Debug + Transform<P::Point> + Send + Sync + 'static,
T::Storage: Tracked,
Y: Default + Send + Sync + 'static,
D: Send + Sync + 'static + TreeValue<Bound = B> + HasBound<Bound = B> + GetId<Entity>,
type SystemData = (Entities<'a>, ReadStorage<'a, T>, ReadStorage<'a, NextFrame<T>>, ReadStorage<'a, CollisionShape<P, T, B, Y>>, Write<'a, EventChannel<ContactEvent<Entity, P::Point>>>, Write<'a, DynamicBoundingVolumeTree<D>>)
The resource bundle required to execute this system. Read more
fn run(&mut self, system_data: Self::SystemData)
[src]
fn run(&mut self, system_data: Self::SystemData)
Executes the system with the required system data. Read more
fn setup(&mut self, res: &mut Resources)
[src]
fn setup(&mut self, res: &mut Resources)
Sets up the Resources
using Self::SystemData::setup
.
fn running_time(&self) -> RunningTime
[src]
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
fn accessor(&'b self) -> AccessorCow<'a, 'b, Self>
[src]
fn accessor(&'b self) -> AccessorCow<'a, 'b, Self>
Return the accessor from the [SystemData
].
Auto Trait Implementations
impl<P, T, D, B, Y> Send for SpatialCollisionSystem<P, T, D, B, Y>
impl<P, T, D, B, Y> Send for SpatialCollisionSystem<P, T, D, B, Y>
impl<P, T, D, B, Y = ()> !Sync for SpatialCollisionSystem<P, T, D, B, Y>
impl<P, T, D, B, Y = ()> !Sync for SpatialCollisionSystem<P, T, D, B, Y>