how do i convert the camera cframe into a lookvector for the characters root part? simple as that. i only want the y axis so they look around but not up/down. im aware there are other posts on this but they arent helpful or descriptive. its almost 3 in the morning here and im literally pulling out hair over this because my character is spazzing when i make a wrong move and i don’t know how to do math in the first place. anything is appreciated.
also, my attempts come from trying to recycle code to make the characters head look with the camera. i didn’t even write the code, i took it from a game i helped a friend clean up, and it works perfectly for its own purpose.
anyways, the code:
local root = chr:WaitForChild(“HumanoidRootPart”)
local hum = chr:WaitForChild(“Humanoid”)
local camDir = root.CFrame:ToObjectSpace(newCF).LookVector
lookDir = CFrame.new(0, 0, 0) * CFrame.Angles(0, -math.atan(camDir.X),
math.asin(camDir.Z)).LookVector
–lookDir eventually becomes the lookvector through proper means (position + lookDir)
and the result:
https://gyazo.com/ce37376a0c3dec7cc41a8940ccb78e76 (head movement is covered elsewhere and doesn’t interfere)
pls i need sleep