- Home /
Want Object to move freely in Camera's Limit
Below is the image about the problem I am facing ... My logic that I have kept maximum horizontal extent to which my plane can go and these lines are drawn which are less dark ...and My camera view is drawn in dark lines ... With this logic my object cannot move beyond the limit I have given...if I increase the maximum horizontal extent then when I will move my plane position nearest to the camera it will go out of the camera scope ...
so what logic should i put so that it can move freely in the cameras limit... ?
Answer by Silencerx · Sep 21, 2011 at 08:03 AM
yo again, the simplest, least math related solution, would be to use an object, or objects as colliders.
i am noticing your making a top down shooter but in perspective, what i would probably do (no expert) would be create 2 boxes, put one on each side tweaked into place. in code set your plane so that as soon as the plane touches the left box, when the player pushes left nothing happens, yet they can still push right and visa-versa.
check out onCollisionEnter might be more performance heavy than doing the math but will work.
As i said in last post ...thanks a lot dude .... Yah but i need your help in making me understand about how to keep that boxes... I will do some research and if i did not understand I will buzz you ...
Your answer
Follow this Question
Related Questions
How do you force a player to look at something? 4 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Code That Is Scene Dependent 1 Answer
TPS camera in multiplayer... 2 Answers