collide-ray 0.3.1

Ray collider implementation for the collide crate
Documentation

Collide: Ray

crates.io docs.rs

Ray type for the collide ecosystem. Dimension-generic (2D/3D/N-D).

Defines a ray (origin + direction) with sphere intersection support. Shape crates implement Collider<Ray> for their types via the ray feature flag.

Usage

use collide_ray::Ray;

let ray = Ray::new(origin, direction);

if let Some((parameter, info)) = ray.intersect_sphere(center, radius) {
    // parameter is the distance along the ray
}

Ray Support in Shape Crates

Enable ray feature on shape crates to get Collider<Ray> implementations:

collide-capsule = { version = "...", features = ["ray"] }
collide-convex = { version = "...", features = ["ray"] }
collide-sphere = { version = "...", features = ["ray"] }