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

How would I use this camera function?

1 answer

✓ Accepted answer

ScreenPointToRay lets you, for example, determine where the player is pointing in the workspace given their mouse coordinates; that is, it'll give you a ray which you can use to raycast to see what the player's mouse is resting on (if anything).

Raycasting is probably too inefficient for your radar. It's probably better is to go through all objects you're thinking of displaying on the radar and determining their position on the radar based on the camera's current .CoordinateFrame (possibly based on the .CoordinateFrame.lookVector)

If you have the position of a model or part, you can use:

relativePos = workspace.CurrentCamera.CoordinateFrame:pointToObjectSpace(pos)

Now, if 'pos' is straight ahead 5 studs relative to the camera, relativePos will be equal to Vector3.new(0, 0, -5).

1 comment

0

Thanks bro!

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