Where should I parent the collision boxes? to the armature or what? I’m making an action game when the collision boxes hits the enemy with a punch, it sends some message damage and animation.
I parent the armature to the collision box and the body mesh to the armature
It depends what the box is for. If it’s for the character’s whole body then you parent the armature to the box.
But if you want a small box around the fist, then you should:
select the box, then the armature,
then go into pose mode,
select the hand bone,
parent the box to the bone (not armature, just bone)
There is probably a much better way to do punches and things like that, but this is the method I’ve used in some of my games.
Tnx for the tip! it worked! Now my problem is, how could the collision boxes send a message to the enemy when they got hit with it? like animation messages.
What I did was I had an integer property and put the name of the property in the frame property box on the action actuator. That sets the property to be whatever frame the animation is on. Then while the property is between two numbers, it sends a message. I thing everybody else just uses rays though.
I dont get it. Any tips at all?
put a property on the collision box, doesn’t matter what type, and name it something meaningful like “collision”. Then, on your enemies, put a collision sensor set to the property collision. That way this collision sensor will fire any time it touches the collision box.
Here’s an example you can look at:
Press space to swing the weapon and destroy the tall box in front of the guy.
Some things you should notice:
The property on the diagonal box which represents the weapon's range. The property on the armature that is used in the attack action actuator. The logic bricks on the tall box. Also notice that the tall box is set to "sensor" and not "static" although it should also work with dynamic objects as well.
I hope this helps.
mannequin.blend (689 KB)