My problem is as follows: I have a a convex hull of some points. Given a point that's outside of said convex hull, I would like to find the closest point on the convex hull.

To that end, I have a representation of the convex hull as a mesh which I plan on adding as a gameObject and simply use Collider.ClosestPoint.

Given this, the mesh created from the convex hull clearly shouldn't be mixed in with other meshes in the game for which collision means something.

I see 3 options to isolate the mesh:

  1. Have it in a separate layer from the rest of the objects and never including that layer in raycasts.
  2. Enabling its collider only when performing the Collider.ClosestPoint operation and immediately disabling it afterwards.
  3. Having the object be isolated to a separate world

Option 1 is a problem as I am developing an SDK and I don't want to count on the people using the SDK not to do raycasts with the default layer mask (which includes all layers except Ignore raycast layer) Option 2 just doesn't feel right as a programmer.

This leaves me with option 3. Problem here is that not only do I not know how to do this, my attempt to follow the instructions fails right off the bat because I can't find this PhysicsWorldIndexAuthoring component, and I cannot find any code examples either.

So, how do I go about creating a new world and placing a gameObject there so it doesn't interact with anything else, or are there other options to achieve my goal of isolating my mesh?


1 Answer 1

  1. is not an option for you
  2. is also too expensive (in addition to be not desireable)
  3. relates to ECS

My advise would be to continue the raycast behind the object hit, tagging it as such, then going after the other potential colliders hit by the same ray / see RaycastAll



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .