2.5D Shooter Rescrict Movement to Camera View

Hello guys. ^^

I am currently trying to create an old style shooter which just moves from left to right, and eventually up. Anyways my problem is that by now i have so many objects and at first i tried to animate everything except the camera and the player, but as you probably guest its way to much work. So i figured i have to actually physically move the camera and the player. My question now.

I want the player to be able to move only in the viewport of the camera minus the hud on the top. Currently i have a mathClamp which isnt working if i move the camera + player because the x and y values change obviously.

I hope somebody out there understands me and can help me. :slight_smile:

Im using Javascript btw. ^^

Add a box collider to your camera then clamp the position of your player to within the boundaries of this box.

Thank you very much Meltdown.

That sounds plausible and in theory it s awesome, but unfortunately i dont know how to clamp in local space of the boundary box. I tried just without code but my player just flys through the box boundaries. I dont know if i am a little idiot right now but i appreciate all help i can get because i cant solve this “mistery”. ^^