What is mouse.origin

HI DEVS,

what is mouse.origin robloxs definition didn’t help i know its a CFrame and that its property of the mouse but i still don’t get it

1 Like

The origin Mouse property is a CFrame indicating where the mouse originated from. It is positioned at the Workspace.CurrentCamera and oriented toward the Mouse ’s 3D position.

Mouse.UnitRay starts at the same position as Origin, and extends for a stud in the same direction.

1 Like

read the post first before replying

1 Like

so mouse.origin is the mouses X, Y as soon as the game runs?

yes, it’s the starting point of the mouse

how is that useful???

No, it’s not.

Imagine you put a Part at the position of your camera, and you oriented that part so that it’s front face was pointing towards your mouse’s 3D position.

Mouse.Origin would represent the CFrame of that part.

1 Like

it is? yes, you can change it but it still is

I think Mouse.Origin is where the player clicks in 3D space, it’s easier to understand if you create an attachment there.

This answer was repeated many times :laughing:

2 Likes

i think mouse.Hit does that Mouse.Hit (roblox.com)

one more question do you get the mouse.origin when player click or every second?

Sorry, I’m not sure exactly what you’re asking.

It’s just a property, in the same way that Name or BrickColor are properties of Parts.

It will be different every time you read it, unless you haven’t moved your mouse or camera since the last time you read it.

You can get the mouse with the following:

local Players = game:GetService(“Players”)

local LocalPlayer = Players.LocalPlayer

local Mouse = LocalPlayer:GetMouse() — Gets mouse instance

print(Mouse.Hit)