#sphere #collision #geometry #game #physics

collide-sphere

Sphere collider implementation for the collide crate

5 unstable releases

Uses new Rust 2024

0.3.1 Mar 22, 2026
0.3.0 Mar 21, 2026
0.2.0 Mar 20, 2026
0.1.1 Mar 15, 2026
0.1.0 May 25, 2021

#2651 in Algorithms


Used in 3 crates

MIT/Apache

23KB
256 lines

Sphere collider implementation for the collide crate.

A sphere is the simplest collider: just a center point and a radius. Collision detection reduces to a single distance check, making it the most efficient collider type.

When using a CollisionManager with only spheres, you get a dedicated layer with optimal performance — no unnecessary branching or memory overhead compared to more general collider types like capsules or convex shapes.

Enable the ray feature to get Collider<Ray<V>> for Sphere<V>.


Collide: Sphere

crates.io docs.rs

Sphere collider for the collide ecosystem. Dimension-generic (2D/3D/N-D).

The simplest and most efficient collider type: center + radius. Collision detection is a single distance check. Use dedicated sphere-only collision layers for optimal performance compared to more general types like capsules or convex shapes.

Usage

use collide::Collider;
use collide_sphere::Sphere;

let a = Sphere::new(center_a, 1.0);
let b = Sphere::new(center_b, 1.5);

if a.check_collision(&b) {
    let info = a.collision_info(&b).unwrap();
}

Features

  • ray — enables Collider<Ray> for ray intersection support

Dependencies

~605KB
~13K SLoC