module Eagle::Physics2D::Collision

Overview

Low-level collision tests on world-space shapes. The world uses them; you rarely need them directly.

Extended Modules

Defined in:

eagle/physics/collision2d.cr

Instance Method Summary

Instance Method Detail

def circle_circle(a : Circle, b : Circle) : Manifold | Nil #

Circle against circle.


def circle_polygon(c : Circle, p : Polygon) : Manifold | Nil #

Circle against polygon.


def overlaps?(a : Shape, b : Shape) : Bool #

True when two shapes overlap.


def polygon_polygon(a : Polygon, b : Polygon) : Manifold | Nil #

Polygon against polygon, using the separating axis test with face clipping.


def ray_circle(origin : Vec2, dir : Vec2, max : Float32, c : Circle) : Tuple(Float32, Vec2) | Nil #

Ray against circle. Returns the distance and normal, or nil.


def ray_polygon(origin : Vec2, dir : Vec2, max : Float32, p : Polygon) : Tuple(Float32, Vec2) | Nil #

Ray against polygon. Returns the distance and normal, or nil.


def test(a : Shape, b : Shape) : Manifold | Nil #

Tests two shapes and returns a manifold when they overlap.