Well the cameras smoother. New problem, the camera doesnt move any more
From looking at it the post, this requires setting the CameraType to scriptable, which I kinda, dont want to do, so this will be my last resort
Do you not have the cameratype as scriptable right now?
It should be, because else it can’t be positioned by script.
Other than that you can print the humaoidrootpart’s parent and camera.CameraSubject
to make sure your script is handling the correct object.
Yeah uh . . . .
Anyhow from attempting to do what you said, I created this, which doesnt work, and honestly dont know what im doing at this point lol
local RunService = game:GetService("RunService")
local UserInputService = game:GetService('UserInputService')
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local cameraSensitivity = 0.3
cameraOffset = Vector3.new(1.3, 2, 10)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:FindFirstChild('HumanoidRootPart')
--Update the camera every frame
local function updateCamera()
--Get the player's mouse values
local delta = UserInputService:GetMouseDelta()
local cameraRotationX = 0
local cameraRotationY = 0
cameraRotationX = cameraRotationX - delta.Y * cameraSensitivity
cameraRotationY = cameraRotationY - delta.X * cameraSensitivity
cameraRotationX = math.clamp(cameraRotationX, -45, 45)
--Rotate the HRP
local targetPart = hrp
camera.CameraSubject = targetPart
if targetPart then
targetPart.CFrame = CFrame.new(targetPart.Position) * CFrame.Angles(0,math.rad(cameraRotationY),0)
end
--Calculate the new camera position and rotation
local desiredCameraCFrame = CFrame.new(targetPart.Position)
* CFrame.Angles(0, math.rad(cameraRotationY), 0)
* CFrame.Angles(math.rad(cameraRotationX), 0, 0)
* CFrame.new(cameraOffset)
--Adjust the camera
camera.CFrame = desiredCameraCFrame
end
--Loop call
RunService.RenderStepped:Connect(updateCamera)
--Handle character respawn
local function onCharacterAdded(newCharacter)
camera.CameraSubject = newCharacter:WaitForChild("Humanoid")
character = newCharacter
hrp = character:WaitForChild("HumanoidRootPart")
end
--
player.CharacterAdded:Connect(onCharacterAdded)
repeat
camera.CameraType = Enum.CameraType.Scriptable
task.wait()
until camera.CameraType == Enum.CameraType.Scriptable
RunService.RenderStepped:Connect(updateCamera)
yes this should work, so you’ll have to debug by printing. The math is math, so it can’t really be wrong, so it has to be either somewhere else in your project that stops the script from functioning, or some value in the script is not being set to what it should.
I figured out why the camera doesnt move. I never made a system that made it move :[
Are you sure theres no other methods of smoothing out the camera? Coding a 3rd person camera system the works with almost all devices is the last thing I want to code
You can use UserSettings().GameSettings.RotationType and set it to CameraRelative if you want the character to move with the camera.
To make the camera move you can use
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
--Stuff here
end
end)
If you don’t know what to input you can get inspired by the post i’ve sent before, from which i got the camera movement up above.