How the Method space.BroadPhase.GetEntities() works ?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
thiago
Posts: 22
Joined: Sat Oct 16, 2010 10:32 pm

How the Method space.BroadPhase.GetEntities() works ?

Post by thiago »

Hi.
i was using the method space.BroadPhase.GetEntities(frustrum, ent); to perform some culling for my engine and i have some problems
Does it uses some kind of spacial organization to make the search faster ? (iam asking this because i dont know if worth putting my scene into a Octree(or something else) just for culling, if bepu engine does it for me, why should i done twice ?! ) This method was build for that purpose (culling), or can be used for that without hurt the performance ??
The problem is that i need some kind of scene organization principally for terrain, but i thing that the physic engine uses something like this (and i cant access ), if i implement another system that does this, its a waste of processor time ...
Does it find Triangle Meshes ? I made a test and Sometimes (rarely) it does not show. The triangle meshes disappeared for some frames !!! (maybe is my fault ><)
And the last one, Bepu calculates the Bounding Box of Triangles meshes automatically ? (or i need to take all the points and create one manually)

Thanks as always ;)
Thiago Dias Pastor
thiago
Posts: 22
Joined: Sat Oct 16, 2010 10:32 pm

Re: How the Method space.BroadPhase.GetEntities() works ?

Post by thiago »

more one thing i found now, that maybe helps
my test scene has one triangle mesh and lots of boxes
the total number of objects is 120
but sometimes the function space.BroadPhase.GetEntities(frustrum,entities) is
returning more than 400 objects sometimes (entities.count) I dont have that much in my scene !!! ;)
iam not using multithread.


Thiago Dias Pastor
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How the Method space.BroadPhase.GetEntities() works ?

Post by Norbo »

The query uses the broadphase (which defaults to a dynamic hierarchy) to accelerate it, so it can be quite a bit faster than brute forcing. The method is there mainly for completeness with the other bounding shapes. It can be used for culling, but specialized approaches for your system's culling will likely outperform it and suit your needs better.

In v0.14.3, triangle-using objects like the Terrain and StaticTriangleGroup are not members of the BroadPhase. Instead, the triangles they create are. This probably explains the oddities you saw (object count, incorrect culling). In v0.15.0, those 'triangle groups' are becoming first-class broadphase citizens, so a query would only grab the parent Terrain instead of a bunch of constituent active triangles.

The TriangleMesh does create a bounding box during its reconstruct/refit phase.
Post Reply