So i tried to make a headless-first-person camera, but when i change the CameraSubject
, the auto rotate stops.
Example.rbxl (18.0 KB)
How can i go about fixing this?
So i tried to make a headless-first-person camera, but when i change the CameraSubject
, the auto rotate stops.
Example.rbxl (18.0 KB)
How can i go about fixing this?
If I you want the character to rotate based on camera rotation, then maybe this works.
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local cam = workspace.CurrentCamera
plr.CharacterAdded:Connect(function(char)
local hum, hrp = char:WaitForChild("Humanoid"), char:WaitForChild("HumanoidRootPart")
local direction = hrp.CFrame.LookVector
while hum and hrp and char.parent and hum.Health > 0 do
local camLookVec = cam.CFrame.LookVector
local lookVecX, lookVecZ = camLookVec.X, camLookVec.Z
if lookVecX ~= 0 or lookVecZ ~= 0 then
direction = Vector3.new(lookVecX, 0, lookVecZ).Unit
end
local hrpPos = hrp.Position
hrp.CFrame = CFrame.new(hrpPos, hrpPos+direction)
RunService.RenderStepped:Wait()
end
end