Trait Collide

Source
pub trait Collide<T: Collider> {
    // Required method
    fn collide_with(&self, _other: &T) -> bool;
}
Expand description

The Collide trait is used to define collisions between two Colliders.

Required Methods§

Source

fn collide_with(&self, _other: &T) -> bool

Checks if two Colliders intersect.

Returns a bool indicating whether a collision occured.

§Examples
use moon_engine::Point;
use moon_engine::collider::{Collide, Circle};
let a = Point::new(0.0, 0.5);
let b = Circle::new_size(0.1);

let collision: bool = a.collide_with(&b);

Implementors§

Source§

impl Collide<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>> for AABB

AABB and Point Collision

Source§

impl Collide<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>> for Circle

Circle and Point Collision

Source§

impl Collide<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>> for Point

Point and Point Collsion

Source§

impl Collide<AABB> for AABB

AABB and AABB Collison

Source§

impl Collide<AABB> for Circle

Circle and AABB Collision

Source§

impl Collide<AABB> for Point

Point and AABB Collison

Source§

impl Collide<Circle> for AABB

AABB and Circle Collision

Source§

impl Collide<Circle> for Circle

Circle and Circle Collision

Source§

impl Collide<Circle> for Point

Point and Circle Collison