Static meshes optimised?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
chebob69
Posts: 40
Joined: Thu Aug 16, 2012 7:27 pm

Static meshes optimised?

Post by chebob69 »

Quickest, and probably simplest question ever:

Is there any benefit in creating collision rules for various static meshes that you've positioned overlapping each other? E.g a tall box representing a building that intersects the ground.
Or does their nature mean that bepu knows they won't interact with each other?

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

Re: Static meshes optimised?

Post by Norbo »

Static/kinematic objects are not tested against each other by default. The mechanism behind it is actually collision rules; static and kinematic objects belong to a different CollisionGroup by default that only collides with dynamic objects (CollisionRules.DefaultKinematicCollisionGroup versus CollisionRules.DefaultDynamicCollisionGroup).

That said, there still remains a tiny cost of actually evaluating those collision rules and realizing the pair can be skipped. It's extremely trivial compared to a full pair test, but you still may find in large simulations that avoiding it is useful. A StaticGroup containing the relevant static objects is a good option in such a case.
chebob69
Posts: 40
Joined: Thu Aug 16, 2012 7:27 pm

Re: Static meshes optimised?

Post by chebob69 »

Ahh, excellent. Haven't encountered the StaticGroup yet. From a look at the error messages, you have to give it a list of collidables for its constructor?
Can you not assign groups like you did with the collision group? What if you wanted to add more to it at runtime?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Static meshes optimised?

Post by Norbo »

StaticGroups are the static equivalent of compound collidables. Since a hierarchy is created for the set of contained objects, any additions or removals require a hierarchy update. Currently, the StaticGroup (and CompoundShape) do not support mutability. That's on the roadmap, though.
Post Reply