x


Check if object is being rendered

Is there a way to check if a object is within any cameras render area?

more ▼

asked Aug 13 '10 at 01:56 AM

Mattivc gravatar image

Mattivc
1.7k 55 60 67

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first
more ▼

answered Aug 13 '10 at 02:14 AM

qJake gravatar image

qJake
11.6k 43 78 161

(comments are locked)
10|3000 characters needed characters left

Yes! I don't know how often you'd want to check it, but if you want it per frame..

var objectToStalk : GameObject;
private var objectToStalkRenderer : Renderer; // Cache this so its faster

function Start()
{
 objectToStalkRenderer = objectToStalk.renderer; // This reduces a get_component call in the update loop
}

function Update()
{
  if (objectToStalkRenderer.isVisible) print ("Jessica Alba is hot.");
}
more ▼

answered Sep 07 '10 at 01:42 PM

jtbentley gravatar image

jtbentley
579 3 4 16

Brilliant answer.

Jun 06 '12 at 11:00 AM tomka

Should I attach a script on the player

Feb 22 at 08:32 AM Elmar1498
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3000
x2086
x336

asked: Aug 13 '10 at 01:56 AM

Seen: 2097 times

Last Updated: Feb 22 at 08:32 AM