Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to calculate the local position given a ray and a part?

Asked by 1 year ago

Hello!

My goal is to calculate the position in which the X axis centers at any point on the part. Given that the ray hits on the very side of a rotated part, I would like to find the new position of it centered at X. I’m stuck on this problem and have some idea that it might deal with object vs world space.

For example, I raycast down and find a part in which I want a part to snap to. I want to keep the Z and position and just edit the X to center along the part. In the image below, purple represents the original ray position and the green represents what I want it to update too.

https://imgur.com/a/Epyhklh

Any guidance on methods I could use would be greatly appreciated!

Answer this question