I started to script a plugin for a game I’m working on, but I ran into a problem with one of the features. I’m trying to create a part at the position of the mouse but the part is aligned with the middle of the object the mouse has targeted. (look at the picture below for a better explanation)
So basically the part is in the middle of the object but can be moved in the other direction (the red line)
I got it to work as long as the targeted object is on a straight line with the grid. If the object is rotated for example 45° the part just moves further in a straight line and isn’t in the middle of the object anymore.
I know this is kind of a bit complicated but if someone just could tell me in what direction I should look or what I should use to solve this, it would help a lot!