As of commit 2a2b05c42ada643eb3a535b497d0da7e16ebef41, the primitive volume index is sent to the click handler. Use this instead of relying on a point being inside a shape which is unreliable.
Click handler should be notified about the primitive volume that the ray collided with, which will make selecting objects in the world a lot more reliable and easier.
Use the same constant for class ShapeVolumeTool and struct ShapeVolume, since we do plan on increasing this in the future. Having multiple constants can cause hard to find problems when tweaking this.
Render recast geometry at its original location, render detour geometry 4 units from its original z-axis to avoid clipping. The previous values were too extreme and caused the cursor to visibly clip in recast geometry.
Allow caller to filter out what to collide with. For the editor cursor, we want to test on everything (including triggers). For the traverse link algorithm, we only want to test on clip brushes or world geometry as traversing through a trigger volume is valid.
* Only run rcGetChunksOverlappingSegment when we do intersection queries on world geometry (major optimization).
* Always find the closest intersection if caller provided tmin, and skip out if caller didn't while our ray intersected with something (major optimization for larger levels with a high number of primitive volumes).
* Reduce max overlapping chunk indices to 512, this was increased to 4096 during the initial coordinate system conversion but this was not necessary and ultimately bloated the stack.
Similar to the intersection test for cylindric volumes. The old convex hull intersection test in the raycast algorithm is inaccurate and also doesn't calculate the hit time, which prevents the editor from placing the cursor at the intersection. Raycast algorithm is pending a refactor and its convex hull isect test will be replaced with this.
Cylindric and AABB volumes can now also be used to mark out area's on the NavMesh. The raycast tests now also take the new shapes into account. User can now also add shapes through the ShapeVolumeTool (previously ConvexVolumeTool). The geomset format has changed slightly:
- identifier 'o' now maps to off-mesh links (previously 'c').
- identifier 'p' now maps to convex polygon volumes (previously 'v').
- identifier 'c' maps to cylinder volumes.
- identifier 'b' maps to box volumes.
'rdIntersectSegmentCylinder' is a new function that will be used for intersection tests on cylindric clip volumes.
'rdIntersectSegmentAABB' was already present in the library, but used and reimplemented across multiple source files (pending deduplication).
Very useful utility when automating the creation of geometry bounding boxes to be used to mark and flag certain polygons on the navmesh (e.g. a door or hazard area through bounding boxes from a mesh or box-shaped trigger).
Instead of a box query, just take the position in the tile grid the land-side off-mesh vert is on. This vastly improves the query reliability for off-mesh links with a larger radius to the point it never fails if it is in a valid location. The box query isn't needed here as the off-mesh vert has to be on a tile, else the polygon box query will fail (unless its bounding box does happen to overlap with the point, but in this case the off-mesh connection is placed improperly causing the only factor to have its link established being luck).
The implementation was commented as it was unfinished. The code now properly checks if the convar was already registered. The code now also deallocates the convar memory on shutdown.