x


Detect GameObject Blocked

I made a model that can be dragged and rotated with mouse. And then I add some tag to the model. So whenever the model rotate, the tag rotate with it. I wonder how we can detect if a tag is rotated behind model. The tag is invisible from the camera view, because it is blocked by other object. Is there a function I can use or is there a common way to check that?

I am new to unity3d. Thanks for helping me out.

more ▼

asked Mar 16 '11 at 01:03 AM

mrzeng12 gravatar image

mrzeng12
1 1 1 1

well, thanks Noah. I think I didn't make myself clear. I try to detect if the tag is visible from the camera, whether there is other object block (occlude) the tag.

I did a little search, it seems to be an issue since unity does not have build in function for it. OnBecameVisible, OnBecameInvisible don't serve the purpose.

Mar 16 '11 at 02:38 AM mrzeng12

Well, can you explain why OnBecameVisible and OnBecameInvisible doesn't work in your case, because these events do exactly what you described. Do you want to know when it's partially occluded? Maybe just tell us what's the desired end result you want to achieve. What exactly is your "tag"? I'll guess another GameObject?

Mar 16 '11 at 03:57 AM Bunny83

Thanks Bunny. Yes, "tag" is another GameObject. I want to detect if one gameobject is behind another one, so it is not visible from the camera, like an total solar eclipse. To my understanding, onBecameVisible is always true in this situation because the GameObject behind might cast shadow or reflection on the one in the front, and therefore it is rendered. So OnBecameInvisible cannot be triggered.

Mar 16 '11 at 09:33 PM mrzeng12
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x2978
x76
x64
x15
x8

asked: Mar 16 '11 at 01:03 AM

Seen: 923 times

Last Updated: Mar 16 '11 at 01:03 AM