How can i check what direction a players camera is facing based on their character

How to check what direction a players camera is facing based on their character

for example, if a character is faced forward and the camera is looking to the left of their character, how could i detect that?

2 Likes

Use the cframe.LookVector of both the camera and the player character primary part

1 Like

How would you code this?
aaaaaaa

1 Like

Sorry I’m on my phone I can’t :disappointed_relieved:

2 Likes

Its ok thank you
aaaaaaaaaaaaaa

Good luck btw
Eeeeeeeeeeeeeeeeee

1 Like

This shows how you can get the direction from their CFrames

local camera = workspace.CurrentCamera
local camDirection = camera.CFrame.LookVector

local character = player.Character
local charDirection = character.PrimaryPart.CFrame.LookVector

Then substract chardirection - camdirection and u will get the relative direction .

How could I use this to see if a characters using looking forward or left etc

It prints a CFrame so am not sure how to do it

How can i use this to see where a players camera is looking *

So you want to check rather a player is facing his camera in the same direction of his character or not? You can use :Dot, for example Character.CFrame.LookVector:Dot(Camera.CFrame.LookVector), it should output a value according to it, note down a threshold yourself and it shall work

1 Like

i Was looking for that
thank you sorry for expaling it bad

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.