x


Detect OnMouseUp on gameobject with different colliders

Hi, i have build in different boxcolliders in my scene to detect where my orbitcamera is moving and reacts on it with different lightsetups. This works great.

But now ive created an sphere and i want to click on that object. On that sphere ive added a simple script to test it:

void OnMouseUp()
    {
        print(gameObject.name);
    }

While running the sphere-message doesnt appear because the different box collider (for the camera) is overlaying my sphere. Is there any way to get both things working? However can i click on my object and check whether ive clicked on my sphere-collider?

Thanks for your time and any hints..

Edit: Ive tested to give the box collider for my camera script an extra layer and my sphere an extra layer. I thought this would help, but unfortunately not..

more ▼

asked Apr 22 '10 at 02:16 PM

yosh gravatar image

yosh
901 73 81 94

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

1 answer: sort voted first

Put the box collider for the camera on the IgnoreRaycast layer.

more ▼

answered Apr 22 '10 at 07:18 PM

Eric5h5 gravatar image

Eric5h5
81.5k 42 133 529

Thx for your reply. Ive set the parent object with these 5 colliders on "ignore raycast"-layer, but though i cant click on my sphere object.... Any ideas?

Apr 23 '10 at 07:31 AM yosh

@yosh: Set all the objects to the IgnoreRaycast layer, not just the parent.

Apr 23 '10 at 03:40 PM Eric5h5
(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:

x5272
x1765
x181
x92

asked: Apr 22 '10 at 02:16 PM

Seen: 2173 times

Last Updated: Apr 22 '10 at 02:23 PM