There are times where you want to check multiple intersections at once. There are several problems with the current lineIntersectsSurfaces command:
- Every new instance of the command has to search the game's quad tree for objects. It can be done only once.
- The command parameters are so limited. Sometimes you want intersections with a certain object(s) only. But having to search the quad tree for irrelevant objects is a huge waste of performance.
- Doing multiple intersections at once has the potential for multithreading, which may give a huge performance boost.
Which is why a new, more flexible command is now requested: linesItersectSurfaces
linesIntersectSurfaces [ [ //array of point pairs, which are the intersection lines [p1, p2], [p3, p4], ... ], [], //array of objects (either to ignore or include, depending on the mode; see below) [], //array of types (e.g. "MAN", "B_soldier_F", etc.) (either to ignore or include, depending on the mode; see below) true, //intersect mode: true: only intersection with above types/objects; false: ignore those types/objects; default is false true, //sort mode; default is true 1, //number of intersections per line; default is 1 ["GEOM"], //array of LODs; if not possible, two lods like lineIntersectsSurfaces; default is ["VIEW", "FIRE"]; false // only unique results per line; default is true ]
returns an array of array of intersection results:
[ [ [interPos, interNormal, interObj, interParent], ...], //[p1, p2], [ [interPos, interNormal, interObj, interParent], ...], //[p3, p4], ... ]