Edge Detection from Mouse

Basically, if you’re trying to figure out which edge of a part a Vector3 is closest to, I would do something like this:

  1. Get the position in object space - use local localPos = Part.CFrame:ToObjectSpace(mousePosition).p for that
  2. Check the components of that vector.
  3. (for example) If localPos.X is close to Part.Size.X / 2, then you’re on the right-side face. If localPos.Y is also close to -Part.Y / 2, then you’re also on the bottom-side face. Hurray! Now you know you’re on the right-bottom edge!
3 Likes