Make entities collide only with static mesh?
Posted: Thu Jul 19, 2012 12:22 pm
When I kill an enemy I break it apart into pieces. Each piece is a physics box. I create them when the enemy is created. When the enemy dies I add them to the space. After 30 seconds I remove them from the space. When the enemy is re-spawned and dies the boxes are once again added to the space, and the cycle continues like that.
The problem I have is: if I kill many enemies at the same time, I am getting low frames per second.
Is there a way to speed this up? I thought one solution would be to make the boxes collide only with the static mesh group and not with each other or anything else. If so, how would I go about doing it? I have added collision rules so that one entity would ignore another, such as a grenade ignoring the body of the character, so he doesn't stand on it.
Like this
However If I have 25 enemies, each with 15 bones, I would need to create many collision rules. Nevertheless is that the way?
I would prefer to keep it as it is, with all the bones colliding with one another, as I like that the enemies can walk over the bones of others and also that a grenade can catch in the bones.
You can see in this video, what I am waffling about. You can skip to 6:00 to see the final result.
The problem I have is: if I kill many enemies at the same time, I am getting low frames per second.
Is there a way to speed this up? I thought one solution would be to make the boxes collide only with the static mesh group and not with each other or anything else. If so, how would I go about doing it? I have added collision rules so that one entity would ignore another, such as a grenade ignoring the body of the character, so he doesn't stand on it.
Like this
Code: Select all
CollisionRules.AddRule(grenadePhysics, SM.Character.CharacterController.Body, CollisionRule.NoBroadPhase);
I would prefer to keep it as it is, with all the bones colliding with one another, as I like that the enemies can walk over the bones of others and also that a grenade can catch in the bones.
You can see in this video, what I am waffling about. You can skip to 6:00 to see the final result.