Grouping entities for raycasting

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
seabert
Posts: 11
Joined: Sun Aug 29, 2010 10:33 pm

Grouping entities for raycasting

Post by seabert »

Hi Norbo / everyone!

In my project I would like to do some ray casting against entities. The problem is I don't want to check every entity in the space. (Only terrain/debris/etc. )
What is the best practice to handle this? Ideally I'd love to add entities to a group and add that group to the space or something.


Thanks in advance!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Grouping entities for raycasting

Post by Norbo »

Right now, there's not a great option other than maybe trying to create a separate broadphase. That will probably have difficulties of its own in the current version. Filtering using the multi-hit raycast method versions are probably the simplest/best bet.

In v0.15.0, in addition to the raycasting overhaul, there are a few new data structures. All of the collision objects implement an interface which allow them to be used with them. You could add the objects that you're interested in raycasting against to one of these BoundingBoxTrees and query them speedily. The BoundingBoxTree is designed to be used with objects which generally don't move significantly relative to each other, though.

Later (probably v0.16.0), there will also be a specialized dynamic bounding hierarchy similar to the current broadphase that can be used separately for raycasting acceleration. This structure will likely also be used to accelerate raycasts on future broadphases whose structure doesn't immediately offer raycast acceleration.
seabert
Posts: 11
Joined: Sun Aug 29, 2010 10:33 pm

Re: Grouping entities for raycasting

Post by seabert »

All right cheers Norbo for the fast reply.
I will use your method until the new version arrives.

Keep up the awesome work :o
Post Reply