#How do I implement camera lock on bounds for a CFrame?

1 messages · Page 1 of 1 (latest)

mint breach
#

Background:
I recently made a camera lock system where I can lock onto certain enemies which eliminates the need for camera work. It works pretty well, but when jumping on enemies' heads it tweaks out. I also tested it with enemies that would be high up, and it's funky then too. So I decided to try to put in some camera bounds (45 and -75). I tried using CFrame:ToOrientation() to get the X value and then multiply the camera's CFrame by CFrame.Angles(math.deg((45 or -75)-X)) but that didn't work.

TL:DR:
I'm trying to bound the camera rotation around the x axis to be a maximum of 45 degrees upwards and 70 degrees downwards. How would I adjust the angle of a camera's CFrame?

soft agate
#

math.clamp(x,math.deg(-70),math.deg(45)) maybe?