proximity_query3d/
proximity_query3d.rs

1use parry3d::math::{Pose, Vector};
2use parry3d::query;
3use parry3d::shape::{Ball, Cuboid};
4
5fn main() {
6    let cuboid = Cuboid::new(Vector::new(1.0, 1.0, 1.0));
7    let ball = Ball::new(1.0);
8    let cuboid_pos = Pose::identity();
9    let ball_pos_intersecting = Pose::translation(1.0, 1.0, 1.0);
10    let ball_pos_disjoint = Pose::translation(3.0, 3.0, 3.0);
11
12    let intersecting =
13        query::intersection_test(&ball_pos_intersecting, &ball, &cuboid_pos, &cuboid).unwrap();
14    let not_intersecting =
15        !query::intersection_test(&ball_pos_disjoint, &ball, &cuboid_pos, &cuboid).unwrap();
16
17    assert!(intersecting);
18    assert!(not_intersecting);
19}