Page 1 of 1

Ignore particular objects when doing RayCast

Posted: Mon Feb 23, 2015 8:30 am
by aeroflyluby
Hello,

how can I force the raycast alghoritm to ignore particular objects in world?
My scenario is: I have a ball which position is bound to camera position. Therefore, if I raycast exactly from camera position - it will hit the ball within the camera is.

Re: Ignore particular objects when doing RayCast

Posted: Mon Feb 23, 2015 5:51 pm
by Norbo
Use an overload which takes a filter delegate, or use the overload which returns multiple hits and manually filter the results.

For example:

Code: Select all

            var filter = entry => entry != ThingThatShouldNotBeDetected;
            Space.RayCast(ray, filter, out result);