Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to know where a player is looking?

Asked by
Mystdar 352 Moderation Voter
9 years ago

Is there a way to know where a player is looking, say if they are looking down (Angle of depression) or up (Angle of Elevation), and can you know the angle they are looking down at. (I'm not even sure if the camera has rotation properties or not) Preferably I wouldn't want to use a part, and check if the part is in the camera, because I intend for it to be a Third-Person game.

I know you can get the current camera through:

game.Workspace.CurrentCamera

3 answers

Log in to vote
2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Not exactly the angle, but you can know the position where it's facing. It's called CoordinateFrame. It's a property of the Camera and defines the CFrame position. Hope this helped,

0
Helped me enough Mystdar 352 — 9y
0
Glad I could help. Shawnyg 4330 — 9y
Ad
Log in to vote
1
Answered by
Uroxus 350 Moderation Voter
9 years ago

I've found some of this information from a few other questions.

But do you this you need to use lookVector. it is a property of CFrame which allows you to access which way an object is facing. I dont know if this answers your question properly or not, But if it does, make sure to accept the answer :)

0
Can I have an example of look vector being used? Mystdar 352 — 9y
Log in to vote
-1
Answered by 9 years ago

Sry I can't Comment, so if u want to see how lookVector is being used,

--if u for example want to change the Part's Velocity into a certain direction then,
Part.Velocity = Part.CFrame.lookVector * 100 --pretend that Part is defined

sry but, I don't know other examples to show u :/

0
I mean not 'in certain direction' but to the direction that the Part's Front Surface is Facing... Kapitanovas 0 — 9y

Answer this question