Static mesh and entity collision

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
limeh
Posts: 30
Joined: Sat Apr 30, 2011 7:22 pm

Static mesh and entity collision

Post by limeh »

I have a static mesh but i dont want it to collide with a specific box. However, this box is dynamically created while the mesh is the level which loads from the start. I wan the static mesh to collide with other things but how do i make it not collide with the box?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Static mesh and entity collision

Post by Norbo »

Most likely, it would be easiest to use a Specific collision rule. For example:
CollisionRules.AddRule(box, mesh, CollisionRule.NoBroadPhase);
limeh
Posts: 30
Joined: Sat Apr 30, 2011 7:22 pm

Re: Static mesh and entity collision

Post by limeh »

Problem is i can't access the box because its dynamically created. So i can't assign the rule before the box is created. When i try to assign it at the box side, it can't access the mesh cause its a var and it can't be public
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Static mesh and entity collision

Post by Norbo »

If you'd like to maintain that access pattern, then doing something with collision groups might be the best option. Instead of assigning a collision rule between two specific objects, you can create collision groups and define rules between the groups. Then, assign the groups to objects. So long as you have access to the groups during both cases, it would work. Some examples of collision groups can be found here:
http://www.bepu-games.com/forums/viewto ... f=4&t=1238
http://bepuphysics.codeplex.com/wikipag ... umentation
and in the Collision Filtering demo.

There has to be some common access in both areas, though. Depending on how things are set up and what is needed, it may be easier just to make the mesh visible and add the rule on box creation.
Post Reply