I have a mesh M
, that is made up of triangles. This mesh will then move in a straight line L
that you can represent as a single vector. I need to detect if this sweeping mesh will collide with a static line segment, preferably in an a priori (continuous) way. Here is a MRE:
pub struct Triangle {
pub a: Vec3,
pub b: Vec3,
pub c: Vec3,
}
pub struct Line {
pub a: Vec3,
pub b: Vec3,
}
pub struct Mesh(Vec<Triangle>);
fn collides(mesh: Mesh, path: Vec3, line: Line) -> bool {
// ...
}
And to better help visualize it, here is an interactive example:
https://www.desmos.com/3d/awxbt16pqj
I need to detect if the gray line will collide with the moving (red) cube.
All resources online are either mesh/mesh collision detection or use discrete simulation steps. I would like this to be as fast as possible (as it will be run hundreds of thousands of times on the gpu), and I would like to use a continuous solution. It is also important to mention that I do not need to know about where the 2 items will collide, just if they will.