I am struggling with a problem of finding out how I can make a part follow the mouse on 2 local axes of a secondary part. The secondary part is supposed to show the local axes of the whole thing.
So I want to be able to make a part follow the mouse in an area like this:
That plane has some axis n
If your mouse draws a ray through it, and that’s the position you want, then you need n:Dot(camPos + mouseDirection * dist) to be zero for some dist, which means on the plane. However, if you convert to the secondary part’s local space then this is along a specific axis and you just need to make that zero. If the plane is the Y axis of the part:
world intersection is where the line formed by the mouse and the camera intersects the plane you drew. mouse direction is the direction of that ray. both are in world space.