✅ Math problem related to drawing a line renderer relative to an object in Unity

If I click on my cube and drag, the line renderer draws in the opposite direction of the cube as expected. If I click to the side and drag, the line is now out of place. I want the line to always behave as if the click began at the center of the cube. Here is a photo of what these two scenarios looks like, first dragging down starting from the cube, next dragging down to the right of the cube:
Here is the code:
https://hatebin.com/jblqsjbqsl
image.png
image.png
Was this page helpful?