I’m trying to make a third person camera script and I suck at CFrames.
Can anyone explain to me why people say to use .rad() instead of degrees?
When I converted from using degrees to using rad, it only made the rotation sensitivity slower.
Second question, does anyone know how much of a performance hit a popper cam would have if you fired a raycast every RenderStepped to see if there is an object between the camera and the character?
Third question, why is it that in CFrame.Angles(var1,var2,var3), changing var1 will rotate the object in the Y axis and not the X axis?
Fourth question, why does the order you multiply a CFrame change its outcome?
For example, in this desired outcome, the camera rotates around the root part:
Camera.CFrame = CFrame.new(rootPart.Position) * CFrame.Angles(0, math.rad(cameraAngleX), 0) * CFrame.Angles(math.rad(cameraAngleY), 0, 0) * offset
If you move the offset to before you multiply the angles it does this:
Camera.CFrame = CFrame.new(rootPart.Position) * offset * CFrame.Angles(0, math.rad(cameraAngleX), 0) * CFrame.Angles(math.rad(cameraAngleY), 0, 0)
if you multiply the Y angle before the X angle, moving the mouse horizontally will tilt it up or down slightly:
Camera.CFrame = CFrame.new(rootPart.Position) * CFrame.Angles(math.rad(cameraAngleY), 0, 0) * CFrame.Angles(0, math.rad(cameraAngleX), 0) * offset
Merging the CFrame.Angles into one angles will do the same thing as changing the order of angle multiplication + it will also make the control for the camera inversed in the Y axis (trying to go up will make the camera go down):
Camera.CFrame = CFrame.new(rootPart.Position) * CFrame.Angles(math.rad(cameraAngleY), math.rad(cameraAngleX), 0) * offset
Last question, in the desired outcome, why is it that even though the y and x axis rotate based on mouse delta, the y axis is a bit more sensitive?