Finding if a Vector3 point is within a complex object

(Yes I do know this is pretty much a replica of a post in 2017, however it didn’t fit my needs)

  1. What do you want to achieve? I want to be able to check if a Vector3 point is within a part, union, mesh, or any other complex object.

  2. What is the issue? My current solution of GetPartsInParts is suboptimal for what I am trying to use it for, id rather just be able to check the Vector3 point without the need of creating a new part.

  3. What solutions have you tried so far?

-Way to detect if point is in any part I tried this (and its solution), however it did not work for complex shapes such as unions or meshes. (I also would rather not hard-code every shape imaginable, not to mention that I want meshes and unions as well)

-Tried Raycasting, which did not work because collisions could only be detected on a part’s faces, not inside it.

-Tried GetPartsBoundInRadius, however it didn’t respect complicated shapes like unions, meshes, or even spheres. (Though maybe I did it wrong?)

I apologize if I posted this incorrectly, this is my first devforum post.

Your current solution is not suboptimal, it’s actually the most optimal. If the object is truly complex then you’d have to use the algorithms that GetPartsInParts uses which will always be faster than implementing it yourself, even considering you are creating a new instance

1 Like