Typically when I want to define an irregularly-shaped "area" in my 3D game (e.g. for events to trigger), I'll compose it using various 3D colliders and treat them as a group.
Something that could speed up my workflow is to instead use the new Unity Splines package to define an irregular area on my ground, since it is so much easier to "draw" with - far more convenient than the classic collider workflow.
Of course even if you could, the result wouldn't have volume. My idea is that I don't care about the vertical axis - I only want to know whenever the player's X and Z are within the bounds defined by the spline's projection onto the XZ plane.
Is there a reasonable way to use the new Unity Splines package to generate "areas" with the following features?
- Tell me whether a point or collider is within the area's XZ projected plane.
- Generate random points within the area.
I've browsed its API but I can't think of a good way to do achieve this.
At the moment I'm considering that a possible alternative is to use the 2D package to create a plane projection parallel to my terrain, and then draw a 2D polygon collider and virtually update a point on that plane representing the player's XZ on the projection since the polygon collider does have an API to detect collisions - that would speed up my area-making-workflow, but it feels fairly overengineered or even hacky compared to putting lots of 3D colliders.
My ideal solution is to quickly draw areas with splines and then just reference the Spline object to query whether the player is inside or not. Or, at the very least, have a button to generate colliders within that spline but I still can't see a way to do that with the current API, that I am aware of.