I've got a small game, where the user uses Horizontal axis to move the camera along Z.
However, it's currently possible to have the camera looking in empty space, far from terrain. It's position doesn't have min Z and max Z. I could of course hardcode the min/max value, but I'm wondering if it could be done more nicely.
Answer by GODLIKE
Oct 03, 2010 at 02:43 PM
You can put two collision planes that act only on the camera or put the min/max Z values editable in the camera script, it's easy, just declare them as variable at the beginning of the script so you can edit them in each scene :)
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
No one has followed this question yet.
How to make Main Camera to not follow object on Y
Headbob jerky movement
How to rotate the camera to the gameobject position.
Buttons move with the camera and I don't want that