# Active collision bounds in the BGE?

How can I have collision bounds that are exact, even during animations. If I have a character with a simple rectangular prism, it won't be realistic. I could have an exact copy in shape but the animations will play and it will be ruined. I could have animations on the collision bounds, but then being stable to the ground won't happen. I could just have simple bounds then another set of perfect bounds, but dynamic object will hit only the simple one. There is obviously another technique for the next step in this topic. How can I have collision bounds that work with dynamic objects, and are perfect in shape to the original character that are also stable to the ground?

I would prefer solutions that do not include python.

• What do you mean? – blackhole Dec 22 '14 at 3:17

Ok, I ignored the "no Python" requirement because the absolute simplest way of doing this requires very few lines of code. Doing it brick-only would be loads of work and very dirty.

Attach this to your animated mesh and run it every frame. It will update the physics to match the mesh.

import bge

def update(cont):
own = cont.owner
own.reinstancePhysicsMesh()

if __name__ == '__main__':
update(bge.logic.getCurrentController())


Example blend

Of course, being parented to the armature means it wont be affected by gravity. So you'll need the armature parented to another object for controlling movement. Make use of Collision Group / Collision Mask to prevent unwanted interference.

• Tell me this, when an object collides, i've seen, it hits what the object looks like. When will it register its collision? – blackhole Dec 22 '14 at 6:26
• The collision registers right when it hits. You can add a Collision sensor -> And controller -> End Object to the falling object and confirm this. Er, and it looks like a rogue property (dyn) found its way into the file. It does nothing and I have deleted it. – pqftgs Dec 22 '14 at 6:35
• Honestly, you did well. I had 2 of 3 of my biggest bge problems solved today. Let me implement it into my game files, and if it works i'll have you as correct answer. Otherwise, i'll update you on it, I will try to have it done soon. – blackhole Dec 22 '14 at 6:44
• How do I add the green/red borders? – blackhole Dec 22 '14 at 6:47
• That would be the physics visualization debug mode. Toggle with Game -> Show Physics Visualization near the top of the window. – pqftgs Dec 22 '14 at 6:51

What you're looking for is Rigid Body Collisions Shape. This option lets you select how the collision bounds of the object collide with other objects. this can be found under the Physics tab.

Obviously, you don't want a man with cube collisions. Triangle Mesh is the BEST option!

This makes the collision surface a triangulated copy of your object and will move with your object even in animations.

Of course there are other options that the computer can calculate faster, so don't use Triangle mesh unless you need it. If Box will do, use it.

Here's an example.

• You can see what's happening in the physics visualization under game options. – Scalia Dec 22 '14 at 17:19
• I have already posted that answer, and the OP said it didn't work. – someonewithpc Dec 22 '14 at 17:27