How would I get the closest position on a part to a line?
Here’s a visualization of what I’m trying to do:
How would I get the closest position on a part to a line?
Here’s a visualization of what I’m trying to do:
Not sure if it is possible like this… but there is maybe a solution which is to add a lot of “attachment” into you part and into your line, so each attachments cover a certain position.
For example, you can put an attachment on each corner, on each middle border, and on each middle face of the part, and put an attachment every 5 studs of your line.
Then via a script, you can loop through all part and line attachments with a for_do, get their magnitude and get the closest one.
It is possible to get the nearest position through magnitude alone, you can do it eventually by getting the same vertical and horizontal position of the main square part and do some simple equations on it. It is fairly simple.