-
What do you want to achieve?
I’m building a movement system of objects in Roblox Studio and I’m not sure how to code the system properly. The goal is to drag one of the axis arrows and the object moves only in the corresponding axis, just like it is in Roblox Studio itself.
-
What is the issue?
I have the 2D mouse screen coordinates X and Y, the selected part, the camera, and I’m not sure how to proceed from there. -
What solutions have you tried so far?
I have tried to set the object CFrame with an offset that’s determined by the difference between the mouse’s X first click down position and the new dragged X position and it works, but the problem is that the movement should be dependent on the camera’s orientation (u can check it out if u go to studio) and I’m not sure how to incorporate that.
My best guess would be that some linear transformation has to be applied to the 2D mouse screen plane that will get the axes to match the 3D world’s axes. I have also tried to do it with mouse.Hit by hitting and dragging on the arrow itself, but it doesn’t work since it’ll move and hit only when the mouse is over the arrow, and that’s not how studio for example works.
If anyone has any ideas about how the system could work, please share.