[][src]Trait mgf::Contacts

pub trait Contacts<RHS> {
    fn contacts<F: FnMut(Contact)>(&self, rhs: &RHS, callback: F) -> bool;

    fn last_contact(&self, rhs: &RHS) -> Option<Contact> { ... }
}

A type that can produce a point of contact with another.

Contacts models a hybrid discrete/continuous approach to collision detection that uses continuous detection to find precise contact points and collision normals over discrete timesteps.

Either the type implementing Contacts or the type paramater must be Volumetric. Both can be as well. In addition, at least one of the types must be Moving in some way.

A Contact collision can potentially produce multiple contacts, in the case of Capsule/Polygon collision and Compound collisions. This is handled by passing a closure to the collision handler.

Required methods

fn contacts<F: FnMut(Contact)>(&self, rhs: &RHS, callback: F) -> bool

Calls the closure for each contact found. Returns true if any contact was found.

Loading content...

Provided methods

fn last_contact(&self, rhs: &RHS) -> Option<Contact>

Returns the last contact found, if one exists.

Loading content...

Implementors

impl Contacts<Moving<Component>> for Capsule[src]

impl Contacts<Moving<Component>> for Plane[src]

impl Contacts<Moving<Component>> for Rectangle[src]

impl Contacts<Moving<Component>> for Sphere[src]

impl Contacts<Moving<Component>> for Triangle[src]

impl Contacts<Moving<Capsule>> for Capsule[src]

impl Contacts<Moving<Capsule>> for Plane[src]

impl Contacts<Moving<Capsule>> for Sphere[src]

impl Contacts<Moving<Sphere>> for Capsule[src]

impl Contacts<Moving<Sphere>> for Plane[src]

impl Contacts<Moving<Sphere>> for Sphere[src]

impl Contacts<Plane> for Moving<Capsule>[src]

impl Contacts<Plane> for Moving<Sphere>[src]

impl Contacts<Rectangle> for Moving<Capsule>[src]

impl Contacts<Rectangle> for Moving<Sphere>[src]

impl Contacts<Triangle> for Moving<Capsule>[src]

impl Contacts<Triangle> for Moving<Sphere>[src]

impl<Poly: Polygon> Contacts<Moving<Capsule>> for Poly[src]

Colliding a moving capsule with a single-faced polygon can potentially produce multiple contacts depending on the angle between the capsule's length and the normal of the polygon's face.

impl<Poly: Polygon> Contacts<Moving<Sphere>> for Poly[src]

impl<RHS> Contacts<RHS> for Compound where
    RHS: Contacts<Component> + BoundedBy<AABB>, 
[src]

impl<RHS> Contacts<RHS> for Mesh where
    RHS: Contacts<Triangle> + Contacts<Rectangle> + BoundedBy<AABB>, 
[src]

impl<RHS> Contacts<RHS> for Moving<Component> where
    RHS: Contacts<Moving<Sphere>> + Contacts<Moving<Capsule>>, 
[src]

impl<Recv, Arg> Contacts<Moving<Arg>> for Moving<Recv> where
    Recv: Contacts<Moving<Arg>> + Shape + Copy,
    Arg: Shape + Copy
[src]

Any two moving object collision can be reduced to a one moving one static object collision. This is done by finding the relative velocity between the two objects.

impl<Recv, Arg> Contacts<Arg> for Moving<Recv> where
    Arg: Shape + Copy,
    Recv: Contacts<Moving<Arg>> + Shape
[src]

impl<ShapeA, ShapeB> Contacts<ShapeB> for ShapeA where
    ShapeA: Convex + Volumetric,
    ShapeB: Convex + Volumetric
[src]

Loading content...