- Home /
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. :)
Im using Javascript btw. ^^
Answer by Meltdown · Jan 15, 2012 at 05:13 PM
Add a box collider to your camera then clamp the position of your player to within the boundaries of this box.
Answer by Punicalol · Jan 25, 2012 at 03:29 PM
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". ^^
Your answer
Follow this Question
Related Questions
Cinimachine virtual camera not updating when in standby mode 1 Answer
3rd pserson shooter camera issue 1 Answer
Mecanim Fps Shooter? 3 Answers
Art is Distorting in 2.5D Project 0 Answers
Top down shooter camera follow cursor 2 Answers