dimforge / ncollide

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

Return the contact normal as a result of TOI computation #290

Closed ghost closed 5 years ago

ghost commented 5 years ago

Resolves #34. Provides an additional query::time_of_impact_and_normal function which returns the contact normal in addition to the time of impact. I decided to make this into a new function in order to avoid a breaking change. In the future it might make sense to combine these two functions into a single function that returns a struct, perhaps similar to the existing RayIntersection struct. Please let me know if any of this needs changing to accommodate a different design or whatnot.

ghost commented 5 years ago

Good catch! I hadn't considered that the normal direction becomes inverted as we call the function with the arguments in the inverse order. I've addressed the issue.

sebcrozet commented 5 years ago

Thanks!