Attacks in Games

I know there are a lot of post about this but none seem to answer my question. I think this is how the logic would go for making an attack in a 3rd person game.

Make the Animation - Press Space - Play Animation

In my test I have did all of this and it is working great. I have a guy punching when I press the space bar. This is where my problem starts, I have placed cubes in line of the punching arm and applied physics to them. When I press “p” to test nothing happens, the boxing don’t react to the arm going through them. I have tried numerous ways of applying physics to the punching arm, but nothing has worked. Any helped would be appreciated.

Also this leads me to another question. When I make an enemy, to make him fight back the simple way I would do this, right? Make Animation - Near Sensor - Play animation. Once I have that would make my health bar and set it to when that animation is played it decreases and when it reaches zero make it end the scene, right? and the basically the same for me attacking him, correct? So I guess what I’m asking is where does physics come to play in game and interaction between people in games? Thanks in advance.

Man, this place is normally really helpful. Did I do something wrong?

No, you didn’t. That all sounds right except that you say when the animation is played, the health bar will be depleted. In this case, your enemy could be 10 units away, play the animation, and your health bar would be depleted. Maybe vertex-parenting an empty to his fist and having a collision sensor to deplete the health bar would work.

~Turin

Love the idea with collision sensor, but still I have my guy punching in the .blend file when I press space bar he punches (plays animation) but the cubes in front of him don’t go flying off. How would I accomplish this?

Try this .blend file: (link fixed)
http://www.savefile.com/files/1225832

I’m not sure if this is what you’re talking about, but it might help. This technique uses a timer property to trigger the “movement” of the cube. When the character punches/attacks, the timer goes off and when it reaches a certain value the cube moves back, simulating a hit. It’s not perfect but it’s affective. If you use it, you’ll need to fine tune it to fit your needs.

Just have an invisible plane represent your hand. Armatures don’t update the collision bounds of its child–you can’t make the box detect the new position of the vertices of the hand when you punch. What you do is make a plane, make it an animation so that it starts near the arm, moves to where you would like the punch to hit, and then return it to the body, as you would when you punch. Basically have it go where the hand goes. As long as it has collision turned on, the object will detect the plane (rather than the hand) and move backwards.