-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid time_of_impact result for Ball and rotated Polyline #19
Comments
Not sure is it related but #[test]
fn time_of_impact_should_return_toi_for_rotated_segment_and_ball() {
let ball_isometry = Isometry2::identity();
let ball_velocity = Vector2::new(1.0, 0.0);
let ball = Ball::new(0.5);
let segment_isometry = Isometry2::rotation(-std::f32::consts::FRAC_PI_2);
let segment_velocity = Vector2::zeros();
let segment = Segment::new(Point2::new(1.0, 1.0), Point2::new(-1.0, 1.0));
assert_eq!(segment_isometry.transform_point(&Point2::new(1.0, 1.0)), Point2::new(0.99999994, -1.0));
assert_eq!(segment_isometry.transform_point(&Point2::new(-1.0, 1.0)), Point2::new(1.0, 0.99999994));
let toi = query::time_of_impact(
&segment_isometry, &segment_velocity, &segment,
&ball_isometry, &ball_velocity, &ball,
1.0, 0.0,
).unwrap();
assert_eq!(toi.unwrap().toi, 0.49999994);
} |
The same tests are passing with ncollide. The main difference I see between these libraries is an attempt to use only one transformation and velocity in parry: parry/src/query/time_of_impact/time_of_impact.rs Lines 87 to 88 in f48629e
|
Thank you for the test cases! You are correct, there is a bug as it should be This will be fixed at part of today's release. |
When using rotated
Polyline
time_of_impact
returns a result as it is not rotated. See tests below for details.This test fails because
time_of_impact
returnsNone
:But this one succeed when
Ball
with given velocity should not reach polyline at all:However when using a
Segment
time_of_impact
behaves correctly:The text was updated successfully, but these errors were encountered: