x


Can I do isVisible for a specific camera?

According to the docs renderer.isVisible becomes true if the objects renderer is visible by any camera. How do I make it only true if visible by a specific camera?

more ▼

asked Oct 07, 2010 at 10:58 AM

Grimmy gravatar image

Grimmy
618 172 129 154

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

1 answer: sort voted first

Okay well it actually 'just works' as long as the cameras are set to render different layers.

Basically 'isVisible' already takes into account the object culling mask..which I didnt realise.

more ▼

answered Oct 07, 2010 at 11:49 AM

Grimmy gravatar image

Grimmy
618 172 129 154

It's more than that. "Visibility" just means whether it gets sent to the GPU to be rendered. It may then be occluded by objects that are closer to the camera. http://forum.unity3d.com/threads/34225-Are-OnBecameVisible-and-OnBecameInvisible-named-poorly?p=222221

Oct 07, 2010 at 02:19 PM Jessy

Yeah I see. I'll need to write something to make sure the object is also facing the camera and not hidden by other objects as well as'being rendered by the camera/sent to GPU' :)

Oct 08, 2010 at 11:42 AM Grimmy

Also be aware that this isVisible is true if the editor camera can see that object. This is a pain when you want to use this variable for game logic like an enemy not shooting at the player unless they are on screen.

Jul 19, 2011 at 03:34 AM Antony Blackett
(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:

x5112
x12

asked: Oct 07, 2010 at 10:58 AM

Seen: 2189 times

Last Updated: Jul 19, 2011 at 03:34 AM