[SOLVED] Having problems with third person controller clamping

I forked PlayCanvas 3D HTML5 Game Engine this project in order to get a look into how third person control works. However, it (and the first person controller project but I digress) have issues with clamping which allows the camera to go 360 degrees along the y axis. I tried using this.eulers.y = pc.math.clamp(this.eulers.y, -45, 45); to clamp the y axis of the camera but whenever I look down, it glitches my camera up? Please help me. :sob::pray:
Source code: PlayCanvas | HTML5 Game Engine

Where do you clamp it? Do it in CameraMovement.onMouseMove after their values have been updated and remove the line where it adds 360 to Y when below zero.

Thank you very much, it works now :grin:

1 Like