How to cast rays through an object

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
yanbo2u
Posts: 21
Joined: Sun Oct 04, 2015 4:41 pm

How to cast rays through an object

Post by yanbo2u »

i need to shoot a ray from a point to the ground( a box ). but sometimes there could be some unexpected objects getting in the way of the ray. I need to let the ray cast as if the unexpected objects never exist.

is it possible? please advise.
yanbo2u
Posts: 21
Joined: Sun Oct 04, 2015 4:41 pm

Re: How to cast rays through an object

Post by yanbo2u »

Found a solution from a earlier post.


viewtopic.php?f=4&t=2319
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How to cast rays through an object

Post by Norbo »

That post is about getting the entity hit by a ray cast in v1, but it doesn't cover filtering considered bodies, which sounds like what you actually want.

In v1, Space.RayCast takes a delegate that can be used to filter out unwanted candidates.

In v2, the IRayHitHandler you pass to the Simulation.RayCast function has AllowTest callbacks you can use to reject objects before testing.
yanbo2u
Posts: 21
Joined: Sun Oct 04, 2015 4:41 pm

Re: How to cast rays through an object

Post by yanbo2u »

Norbo wrote: Sat Feb 29, 2020 8:02 pm That post is about getting the entity hit by a ray cast in v1, but it doesn't cover filtering considered bodies, which sounds like what you actually want.

In v1, Space.RayCast takes a delegate that can be used to filter out unwanted candidates.

In v2, the IRayHitHandler you pass to the Simulation.RayCast function has AllowTest callbacks you can use to reject objects before testing.
Thanks. It works.
Post Reply