Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How is Mouse.UnitRay used? [Examples]

So I was reading up on it and it's a ray that extends from the camera to the player's mouse, which sounds pretty useful to me.

What is the correct way to use it? [Code Example] I don't need anything fancy, but it just confuses me.

Can it be used to show when you have locked on someone when your mouse hovers over them?

1 answer

According to the wiki:

Ray UnitRay [readonly]

A ray starting from the player's Camera and traveling in the direction where the player's Mouse is projecting in the world.

So I'd say like a line from where the camera is to where the mouse is, but I might be wrong, don't quote me on that.

This discussion is preserved as it was. New answers, comments, and votes are closed.