Skip to content

[BUG] assertion failed: denom != 0.0 with convex hull raycast #451

Description

@tlonny

Hi,

I've managed to tease out a seemingly valid convex hull and non-intersecting ray - that upon doing an intersection test causes a panic:

thread 'main' (369438) panicked at /Users/timlonsdale/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parry3d-0.31.1/src/query/point/point_tetrahedron.rs:276:21:
assertion failed: denom != 0.0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
use glam::Vec3;
use parry3d::{query::Ray, shape::SharedShape};

const HULL: [Vec3; 5] = [
    Vec3::new(-34.0, -14.0, 29.0),
    Vec3::new(-24.0, -12.0, 29.0),
    Vec3::new(-32.0, -12.0, 29.0),
    Vec3::new(-32.0, -12.0, 2.0),
    Vec3::new(-24.0, -12.0, 2.0),
];

const ORIGIN: Vec3 = Vec3::new(-16.0, 8.0, 0.0);
const DIRECTION: Vec3 = Vec3::new(-0.5956519, -0.67131174, 0.44106603);

fn main() {
    let hull = SharedShape::convex_hull(&HULL).unwrap();
    let ray = Ray::new(ORIGIN, DIRECTION);
    println!("hit: {}", hull.intersects_local_ray(&ray, f32::MAX));
}

Run this on parry3d 0.31.1

I got codex to generate a standalone HTML artifact so you can view/inspect the ray and the 5 vertex hull (attached as repro.html)

repro.html

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions