Given arbitrary position a, and collection of parts cP, find the position b which denotes, or best approximates the nearest surface projection on the collective surface formed of the parts constituted by the constituent baseParts (of cP), where a, cP are provided and b must be found.
Example use case: detecting how far a character is from the edge of a volume. cP’s surface can be thought of as the idealized surface a Union instance of cP’s baseParts.
Conceptual advice, recommended topics, or psuedocode implementation appreciated, thanks.
I’m sure many of us can help you, but there’s really no need to use math-lingo. It makes it harder for us to actually understand the practical solution you want out of this. There’s a reason only math textbooks speak like that.
Can you give a visual example or explain in more layman terms what you’re wanting? My minor is in math and I still have 0 idea what you’re trying to say.
Personally I would start stripping the RotatedRegion3 Module by @EgoMoose for its maths to achieve this. Iterating through each part we are first detected to be in, and then calculating each surface distance/ position. Though this is kind of guess work. It might be more wise to pursue it directly looking for something on stackexchange like this:
If you do physics engines, this is probably just a matter of reducing the system to what I need. Thing is, I don’t do physics engines.
This assumes straight lines directly to the closest surface from the point. Arbitrary directions are not considered.
EDIT: If you want to consider many possible points on a surface then that is simple as well. You simply need to “pixelate” the surface into a specific resolution instead of doing what I did.
Then filter out surfaces which are colliding with other surfaces. Finally, judge the distance to all possible points from the original.
My code is capable of doing this. Right now I only pick + shaped directional points from to surfaces of intersecting parts. Let me know if you need assistance pixelating the surfaces for considerations.