Calm down, there’s no problem
How do i evaluate if the CFrame of the camera is equal to the minCameraVal
that I have in the function?
Specifically, I would like to make the player play an animation when the camera cframe reaches the value of minCameraVal
, and in the case of else the player will play other animation to return to the idle state, any idea how to do it?
local normalCamera = camera.CFrame:ToOrientation()
-- Camera limitations function
local function limitCameraUpDown(minVal, maxVal, isTrue)
if isTrue == true then
RunService:BindToRenderStep("UpdateLoop", Enum.RenderPriority.Camera.Value, function()
local minCameraVal = minVal -- -34
local maxCameraVal = maxVal -- 150
local rX, rY, rZ = camera.CFrame:ToOrientation()
local limX = math.clamp(math.deg(rX), minCameraVal, maxCameraVal)
camera.CFrame = CFrame.new(camera.CFrame.p) * CFrame.fromOrientation(math.rad(limX), rY, rZ)
if camera.CFrame == minCameraVal then
-- Play bow animation
print('playing anim')
else
print('not playing anim')
end
end)
else
warn('limitCameraUpDown is off')
end
end