I’m trying to set the cameras cframe z value to 0 but for some reason it gives it the value -3.616 instead of 0. I’ve tried using math.rad() but that doesnt change it. here’s the part of the script causing the issue.
game:GetService("RunService").RenderStepped:Connect(function()
local Y = character.Camera.Y.Value
local Z = character.Camera.Z.Value
Camera.CFrame = HRP.CFrame * CFrame.new(0,Y,Z) * CFrame.Angles(math.rad(-20),math.rad(ExpectedZRotation),0)
end)
if you print the value it says 0 however if you go into the camera and check the rotation it shows -3.616. the camera is also slightly tilted on the z axis which proves that the rotation isnt actually 0
theres some variables outside the part of the script which i showed which store it. Also expectedzrotation is supposed to be named expectedyrotation. idk why i wrote z instead of y. I kinda figured out a workaround so its fine now.
idek how this works but here it is. Camera.CFrame = HRP.CFrame * CFrame.new(character.Camera.X.Value,Y, Z + character.Camera.ExpectedZRotation2.Value) * CFrame.Angles(math.rad(-20),math.rad(character.Camera.ExpectedZRotation.Value),math.rad(0+3.616*(character.Camera.ExpectedZRotation.Value/10)))
it’s not perfect but compared to before the tilt is a lot less noticeable. Also btw the Camera in the characters just a folder which stores a bunch of values
That is kind of a mess lol. What is the goal you are trying to accomplish with the camera? It seems like you could just do a bunch of math in a script rather than relying on values stored elsewhere.
I don’t know what you’re trying to achieve here, but if you want to change the camera position relative to the character you can just use Humanoid.CameraOffset.
If you want to set the camera to a fixed position, change the camera’s CameraType to Enum.CameraType.Scriptable.
I was making a custom camera system and I was just experimenting with how camera control works cause i’ve never really worked with the camera before. Thanks for the help!