0.10.0 CollisionPair should be default to noPair

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

0.10.0 CollisionPair should be default to noPair

Post by imtrobin »

Hi

When I add a new collsiongroup, I find that it is normal collsion with all other previous collisiongroup. I think it should be default nopair. The reason of grouping entities with collisiongroup is to prevent certain groups to collide with another. So
say I have

collisionGroup1
collisionGroup2
collisionGroup3

and I add a new CollisionGroup4, I need to add code to disablepair with all the groups I don't want. Imagine I have more than 10 collisiongroup, I have to do it 10x9 times.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: 0.10.0 CollisionPair should be default to noPair

Post by Norbo »

CollisionGroups were not designed primarily to prevent collision between groups of entities, but rather as a more general way to manage interactions. That's why it defaults to normal if no other rule is specified.

For every simulation that would benefit from having group relationships default to noPair, there is another simulation that benefits from having it default to normal. In either case, resolving the issue is fairly trivial. If you want to essentially make every pair relationship noPair by default, you can keep a list of CollisionGroups handy and iterate over it.

I will probably end up adding in a static CollisionRule variable that allows you to specify what CollisionRule to use when no CollisionRule is specified by the entities. You'd still need to iterate over a list of collision groups and make them collide with themselves, though.
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Re: 0.10.0 CollisionPair should be default to noPair

Post by imtrobin »

Yeah I think that would be fine. Manual defining who collide who is easier.
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Re: 0.10.0 CollisionPair should be default to noPair

Post by imtrobin »

Hmm, a few questions.

Do I need to add collisionGroup two times? ? It seems I can do this with the group swapped.

add (new CollisionGroupPair (CollisionGroup1, CollisionGroup2), CollisionRule.noPair);
add (new CollisionGroupPair (CollisionGroup2, CollisionGroup1), CollisionRule.noPair);

Also, it seems I can add duplicates in there.
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Re: 0.10.0 CollisionPair should be default to noPair

Post by imtrobin »

No, the duplicates seems to be my mistake. Sorry about that.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: 0.10.0 CollisionPair should be default to noPair

Post by Norbo »

To clarify, no, you do not need both a relationship between group A and group B and between group B and group A. The two orderings are considered equal as far as the equality comparer and hash code are considered, so a rule between two groups can be thought of as 'two way.'
Post Reply