Impact-rs
This crate provides utilities for performing collision queries between rectangles and rays,
including swept checks for moving rectangles. It leverages fixed-point arithmetic provided by the fixed32 crate to
handle the computations.
Features
- Ray vs. Rect Collision Detection: Detect collisions between a ray and a rectangle, returning contact point, contact normal, and the closest time of collision.
- Swept Rectangle Collision: Check for potential collisions as one rectangle moves towards another. Either using a delta 2D vector, or a scalar sweep in horizontal or vertical direction.
- Fixed-Point Precision: Uses fixed-point numbers (
Fp) from thefixed32crate for precise calculations without floating-point errors.
Usage
To use this crate in your project, add it to your Cargo.toml:
[]
= "0.0.17"
Example
use Fp;
use ;
use *;