Ok so I know how to do camera manipulation. But how can I make it so that a Scriptable CameraType follows the direction the players head faces(I have a head turning script.)
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:wait() local Camera = workspace.CurrentCamera repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = Character.Head.CFrame
Try this:
local offset = Vector3.new.new(0,0,5) -- Offset from the player's Head local camera = workspace.CurrentCamera local RS = game:GetService('RunService') RS:BindToRenderStep('Bind', Enum.RenderPriority.Camera.Value, function() camera.CameraType = Enum.CameraType.Scriptable camera.CFrame = Character.Head.CFrame+offset end)
local function GetAngle(HumanoidRootPart,Camera) local adjustedVector = HumanoidRootPart.CFrame:vectorToObjectSpace(Camera.CFrame.lookVector) -- convert the camera's lookVector into object space so that we know which way the camera is pointing relative to the part the head rotates around local actualAngle = math.atan2(-adjustedVector.X,-adjustedVector.Z) -- this combination will turn the LHR coordinate system into a RHR angle return actualAngle end
https://devforum.roblox.com/t/how-to-make-head-turn-to-cameras-lookvector-direction/99007/3