Discuss any questions about BEPUphysics or problems encountered.
- Posts: 43
- Joined: Mon Aug 04, 2014 8:26 am
I have a rockets that player will shot from rocket launcher, but I don't those rockets collide with some stuff. So, I found one way on forum to do it :
Code: Select all
CollisionRules.AddRule(somestuff, rocket, CollisionRules.NoBroadPhase);
Question is : should I remove this rule after rocket is gone? I will have many players and many rockets so it will be many rules where. Trick is : each rocket will have different items to ignore collisions with, not all rockets don't collide with same objects. So, I will need to create a different rule for each rocket.
- Site Admin
- Posts: 4680
- Joined: Tue Jul 04, 2006 4:45 am
If there are lots of objects to ignore, I would recommend looking into collision groups. If they can express the necessary behavior, they will involve a lot less effort.
If specific collision rules are really needed to express the relationships, then yes, it would be a good idea to clean up the rules when they're no longer needed. (There is a way to avoid doing this if one of the entities is just going to end up getting garbage collected- just make sure the entity to be collected is passed in as the first parameter to AddRule. The entry lives in the first parameter passed in, so when the entity disappears, so will the rule. This is a little hackier, though, and doesn't play nice with pooling.)
Also, if your collision relationships don't map well to the default collision rules setup, you can specify a custom CollisionRules.CollisionRuleCalculator that does whatever you want.
Who is online
Users browsing this forum: Google [Bot] and 2 guests