Hit detection with rigged mesh

Hey guys,

I want to create some kind of hit detection (I wanna learn the basics for some games).

So I have set up a cube with a property called “hp” (health points). And everytime a rigged stick touches the cube, the hp should be subtracted by 1. But for some reason it does not work.

I tried a normal animation without a rig, and there it works, exactly how I want it. But for later projects I wanna use rigged mesh animations.

I hope somebody can tell me what to do to accomplish my goal. I will attach my .blend file.

Thanks everybody and have a nice day!

Best regards,

Franz Wegner


testcollisionblenderartists.blend (492 KB)

Mesh deformation via an armature does not deform the physics collision bounds of the object in the BGE (you can see this clearly in your blend if you turn on Physics Visualization).

Any object that is deformed by an armature that you want to have collisions should have a separate collision box object parented to a bone.

You can update the collision bounds using reinstancephysicsmesh but it can be rather slow.

Bone parent collision boxes to your rig instead of using the reinstance physics mesh; it’s much faster.

All right guys, thanks for the answers.

So let’s say I wanna create a tekken style game. Would be the bone parent solution the best for me?

Sensors parented to individual bones? detect actors, property collision with “head”, "torso?

It depends. If you want the character’s hitbox to correspond to the position of its mesh then yes. If you want a consistent hitbox that doesn’t change, then just make one hitbox that encompasses the character.