I've looked through the ROBLOX wiki and forums and found nothing different about them but using CFrame
values.
There is a difference.
First let me point out that mouse.hit is a property of mouse. This is a CFrame. The .p
property of a CFrame is the position of that CFrame. In other words you are getting the position of the hit CFrame by mouse.hit.p
. Origin and hit BOTH return a CFrame!
The difference is that the origin is "where the mouse came from" (its origin) and the hit is the position where the mouse - uh, well - hits.
So what is this origin then? Where does the mouse start..?
Here is the answer;
1 | local mouse = game.Players.LocalPlayer:GetMouse() |
2 | local h = mouse.hit.p |
3 | local o = mouse.Origin.p |
4 | local pos = game.Workspace.CurrentCamera.CoordinateFrame.p |
5 | print (o, pos) --> Notice that they are (almost?) equal! |
6 | print (h) |
Thus the origin is the same as Camera.CoordinateFrame :) (run above in a LocalScript)