Raycast on StaticTriangleGroup

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

Raycast on StaticTriangleGroup

Post by grobi »

Hi there,
i got a lil prob with raycasting. I have a StaticTriangleGroup in my space and when I perform a space.raycast towards it, I get the hitlocations, the hittimes and an entitylist BUT all the entities in there are NULL!
So is there a way on how to determine if those "NULL-entities belong to the StaticTriangleGroup? Or am I doing something wrong?

Grobi
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Raycast on StaticTriangleGroup

Post by Norbo »

The entity entries are null because there are not necessarily Entities at the points where the ray intersects the StaticTriangleGroup. Right now, one of the most straightforward ways to determine what hits belong to what 'thing' is to manually raycast against each 'thing.' You can call the broadphase's ray cast to get the entity intersections and then call the StaticTriangleGroup's ray cast to get the mesh intersections. The Space.rayCast basically does this internally.

This is one of those areas that needs a redesign, and there are plans in place to address this in v0.12.0.
grobi
Posts: 34
Joined: Wed Sep 23, 2009 5:47 pm

Re: Raycast on StaticTriangleGroup

Post by grobi »

Ah ok. Thought that raycasting on every entity would slow things down and that a raycast from space would be quicker, but if thats basically the same...

Grobi
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Raycast on StaticTriangleGroup

Post by Norbo »

For clarification, the Space doesn't raycast against every entity individually; it calls the BroadPhase's raycast which is accelerated by internal data structures. However, as of v0.10.1, StaticTriangleGroups and other "containers" do not belong to the BroadPhase and are tested individually. This is scheduled to change in v0.12.0.
Post Reply