How to make a mesh physics boundary update with poses?

What I’m meaning here, is that the collision hitbox, for a custom mesh will change when the mesh plays an action. I did it once using parenting, tried to parent a different object, and messed it up. Its so hard to do. Is there an easier way? In real life, your hand does not go through a wall when you flick it to the side. Not only does this look so unrealistic on so many levels, but modern gaming actually has this feature put in where your characters collision hitbox changes to accommodate the pose. I want to do this in Blender, and I accomplished it once using parents, but it is near-impossible. I need help fast!

This is Game Engine physics I am talking about. The one where you set Collision Bounds to Triangle Mesh WITHOUT Compound on.

The correct way of doing it would be to have the Collision bounds set to Capsule with large enough size so that none of your animations go outside of it.
Most modern games actually use something similar to the Overlay Scene in Blender to avoid this issue in FPS games.

Correct setup would be:
One Bounding mesh model with Capsule Collision bounds set to invisible,
Armature is a child of that object and plays all the animations,
Any hitbox body pieces should be invisible boxes parented to major bones of the armature,
Characters visual representation has no collision and is child of the Armature.

How do I resize a Collision Bounds capsle?

Resize the object. If you already parented something to it, do it in edit mode.

The way I do this is to have a series of boxes with their own collision groups. A box for each hand, two each for the forearms, two each for the upper arms, one for each shoulder, four for the torso, a large one for the head, two each for the thighs, two each for the calves, one each for the feet. I parent them to the mesh itself instead of the armature. Then using Python I individually move the boxes using localPosition. It’s a bit like how fighting games do it, and it allows you greater freedom of movement and more accurate hit detection.

in real life your hands go up or down, so you can simply add a ray that cast forward if it hits something play an arms/weapon up/down animation.

simply make hitboxes for each major bone, then parent them to a ‘root’ object - typically the pelvis - and also parent your armature to the root.

mark the root ‘compound’

add empty to then parent each bone, and parent them to the bones facing the same orientation the hitbox should have, name each bound object something smart like Right_lower_arm etc.

have each empty have a prop called ‘target’

each frame do
(this script is in the root)

for child in own.children['armatureName'].children:
    if 'target' in child: 
        own.children[child['target']].removeParent()
        own.children[child['target']].worldPostion = child.worldPosition
        own.children[child['target']].worldOrientation = child.worldOrientation
        own.children[child['target']].setParent(own,1,0)

this will update the child shapes, and collisions with the child objects will effect the root.

1 Like