I am struggling to achieve the following with C# (in Unity). I need to find the position of the points that lay at a given distance (let's say 1m) from the corners of a rectangle, in a way that the segment between these points and the given rectangle corners form 135 degrees with the corresponding sides the of rectangle - no matter where the rectangle goes, what is its rotation or what is its size. Like the following:
So, using the picture above as reference, it means that the red dotted line has always the same length and divides the angle ABC in the middle. So, the angle of the line with AB is 135 and with BC is also 135.
One of the ways to achieve that is the following code:
Vector3 dotpos = rectangle.transform.TransformPoint(rectangle.transform.localPosition.x+1.5F,0,rectangle.transform.localPosition.z+1.5F);
bluedot.transform.position = dotpos ;
The problem is that in such solution the distance between the blue dot and the corner of the rectangle is not independent of the scale of the rectangle. It means, the greater the rectangle, the blue dot goes more distant from the corner.
Can anybody tell what is the most efficient way to achieve what I want, i.e. so the position of the blue dot is always at the same distance from the corner no matter the scale, position or rotation of the rectangle?
PS: blue dot is not an object that can be made child of the rectangle.