Ignore particular objects when doing RayCast

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
aeroflyluby
Posts: 4
Joined: Thu Jan 29, 2015 7:04 pm

Ignore particular objects when doing RayCast

Post 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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Ignore particular objects when doing RayCast

Post 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);
Post Reply