You’d have to hard-code some position in and check their proximity with Vector3.FuzzyEq
. ( Since you did not include the “back” of the part’s edge), otherwise, the edges of a part is given by (omitting the y-axis as it is unimportant)
(Assuming you didn’t rotate the z-axis; if you did you have to do some maths using trigonometry)
(pos.x-size.x/2, pos.z-size.z/2)
(pos.x-size.x/2, pos.z+size.z/2)
(pos.x+size.x/2, pos.z-size.z/2)
(pos.x+size.x/2, pos.z+size.z/2)
Just do if (x2-x1)^2 + (z2-z1)^2 < epilson^2 then
where x1, z1
is the raycast intersection’s x and z position and x2, z2
is the edges’s x and z position