dimforge / ncollide

2 and 3-dimensional collision detection library in Rust.
https://ncollide.org
Apache License 2.0
921 stars 105 forks source link

`Ball::project_point` is incorrect #314

Closed whatisaphone closed 4 years ago

whatisaphone commented 4 years ago

It looks like Ball::project_point is mishandling the radius.

let ball = Ball::new(5.0);
let point = Point3::new(50.0, 0.0, 0.0);
let projection = ball.project_point(&Isometry::identity(), &point, false);
panic!("{:?}", projection);

With a sphere of radius 5.0, I would expect a result of [5, 0, 0], but instead I'm seeing [1, 0, 0]. That point is not on the surface of the sphere.

sebcrozet commented 4 years ago

Hi! I've seen this bug too while working on my salva branch. It will be fixed in the next version of ncollide which will be released this week.