Basically I’m trying to make it so the camera moves along with the player being rotated. This is t he type of effect I want:
This is what the actual camera controller does:
Any tips?
Basically I’m trying to make it so the camera moves along with the player being rotated. This is t he type of effect I want:
This is what the actual camera controller does:
Any tips?
Using Camera.CameraType we can set it to Enum.CameraType.Attach, and I think that’s the effect you want.
To have the camera rotate with the player’s relative rotation in Roblox, you can use the following steps:
local player = game.Players.LocalPlayer.Character
local camera = game.Workspace.CurrentCamera
function updateCamera()
-- code to update the camera's rotation goes here
end
camera.CFrame = player.HumanoidRootPart.CFrame
function updateCamera()
camera.CFrame = camera.CFrame:Lerp(player.HumanoidRootPart.CFrame, 0.1)
end
game:GetService("RunService").Heartbeat:Connect(updateCamera)
This will cause the camera to smoothly rotate with the player’s relative rotation every frame.
however, wouldn’t attach stop the player from moving the camera themselves as well?
I tried to use the Camera/GetViewCFrame() and Camera/GetViewSize() to get the camera’s current settings, then Camera/SetViewCFrame() and Camera/SetViewSize() to change it, but that didn’t work.