Hi!

I need to determine if a collider (of any type) intersects with a plane, how would I go about doing that?

Hi!

I need to determine if a collider (of any type) intersects with a plane, how would I go about doing that?

Using physics, you could create a plane object, set its mesh collider as a trigger and use the OnTriggerStay function to detect when another collider intersects.

To do it mathematically, it’s a bit more difficult because the method isn’t the same for each collider. You would most likely want to start with a Plane object in each case. For a mesh or a cube, you could use the plane’s GetSide function on each of the mesh’s vertices. If there is at least one point on the positive side of the plane and one other on the negative, then the collider intersects the plane. For a sphere or capsule, you would need the plane’s GetDistanceToPoint function to check if the distance of one or more points from the plane is than the radius.