Struggling to limit camera rotation

Hi I’m making a first person game. I’m not quite ready to work in Haxe currently so I’m still working with nodes. I’m trying to use “Mouse coordinates>Movement” to rotate my camera and character. It rotates the character as expected but the camera, which rotates on the local X-axis, can still rotate without restriction. So this means that a player could rotate the camera until it was upside-down and so on. Is there any way to get local rotation values or to somehow restrain the camera rotation between 25 and 140 degrees for instance? “Get rotation” appears to get local rotation only and constraints still aren’t working.

This old method should still work. The X value of the Vectors is the angle at which the camera should be clamped at in radians. (I think you should better read the whole post, maybe your setup won’t work with it)

If you want to use something more simple, try the custom nodes from logic_pack. There are multiple ways to do FPS controllers with these. Way1 Way2

Thank you! I actually found your method to work pretty well! I did change the angles from 0 and 90 to 25 and 120 though! I simplified it a bit, too and got it working! I decided against that camera controller though because when Armory gets updated it tends to break libraries and also your method it far better for controller support! :slight_smile: Thanks for your tips though! Super useful! :smiley:

I’ve tryed using the old version of clamping the rotation but it just won’t work for me (the camera obviously starts at -90 degrees and i`m trying to clamp between -45 and -135 aka ± 45 but i accidentally put -45 instead of -135 in the picture and ive fixed that)