Book Image

Mastering Unity Scripting

By : Alan Thorn
Book Image

Mastering Unity Scripting

By: Alan Thorn

Overview of this book

Table of Contents (17 chapters)
Mastering Unity Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Being seen


There are many occasions during gameplay when questions of object visibility arise, some actual and some hypothetical. Concerning the actual occasion, there are several questions we could ask, including whether object X is visible to camera Y right now, whether object X is visible to any camera right now, or when does object X become visible or nonvisible to a specific camera or to any camera. With regard to hypotheticals, we would ask whether object X would be visible if camera Y were moved to position Z. In the actual occasion case, we're concerned with the real visibility of objects for the current frame, based on the positions of all cameras, and concerning hypotheticals, we're concerned with what would be the case if a camera were moved to a specific position. Both these cases are important for games. Knowing whether objects (such as enemy characters) are really visible to the camera is important to define behavior and AI. This is because when objects are not visible, there...