2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ What do you mean? $\endgroup$ – blackhole Dec 22 '14 at 3:17
5
+50
$\begingroup$

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.

EDIT - Example with collision masks

$\endgroup$
  • $\begingroup$ Tell me this, when an object collides, i've seen, it hits what the object looks like. When will it register its collision? $\endgroup$ – blackhole Dec 22 '14 at 6:26
  • $\begingroup$ 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. $\endgroup$ – pqftgs Dec 22 '14 at 6:35
  • $\begingroup$ 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. $\endgroup$ – blackhole Dec 22 '14 at 6:44
  • $\begingroup$ How do I add the green/red borders? $\endgroup$ – blackhole Dec 22 '14 at 6:47
  • $\begingroup$ That would be the physics visualization debug mode. Toggle with Game -> Show Physics Visualization near the top of the window. $\endgroup$ – pqftgs Dec 22 '14 at 6:51
2
$\begingroup$

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.

enter image description here

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.

$\endgroup$
  • $\begingroup$ You can see what's happening in the physics visualization under game options. $\endgroup$ – Scalia Dec 22 '14 at 17:19
  • $\begingroup$ I have already posted that answer, and the OP said it didn't work. $\endgroup$ – someonewithpc Dec 22 '14 at 17:27
  • $\begingroup$ @BlenderDev what doesn't work about this answer? $\endgroup$ – Scalia Dec 22 '14 at 17:59
  • 1
    $\begingroup$ With triangle mesh, it doesn't update with animations. $\endgroup$ – blackhole Dec 22 '14 at 18:36
  • $\begingroup$ The exact issue with any standard RigidBody collisions. $\endgroup$ – VRM Dec 22 '14 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.