Any ideas? I tried to script it from the Base Camera Module but it’s not camera relative and not seems not work correctly (Somehow you can break the limit).
function BaseCamera:CalculateNewLookCFrameFromArg(suppliedLookVector: Vector3?, rotateInput: Vector2): CFrame
local currLookVector: Vector3 = suppliedLookVector or self:GetCameraLookVector()
local currPitchAngle = math.asin(currLookVector.X)
local xTheta = math.clamp(rotateInput.X, -MAX_X + currPitchAngle, -MIN_X + currPitchAngle)
local constrainedRotateInput = Vector2.new(xTheta, rotateInput.Y)
local startCFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
local newLookCFrame = CFrame.Angles(0, -constrainedRotateInput.X, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.Y,0,0)
return newLookCFrame
end
The problem with that script is that overlaps the current camera and it’s a huge problem for me because I’m making an FPS that uses the standard Roblox camera and I just want to limit the angle of the X Axis when the player uses the bipod (Like Battlefields do).
So I’m using your script (Very useful ) and I’m struggling with setting a max angle of the X Axis and make the camera relative to the player (Like CameraSubject does when the camera is set to Custom) but I didn’t find any useful post explaining how to do it.
Here is the Baseplate with your script and some things I add (Press B to change the camera) just to test it.
In the place file, when switching the camera you can rotate on the X axis all the way around. It looks like OP wants to restrict the camera movement on the X axis while keeping that restriction relative to the player (for example, only being able to look in front of you while in first person). The camera is currently not working in this way.