Page 1 of 1

How to detect a player attack

Posted: Sun Sep 27, 2009 9:22 pm
by prchakal
Hi,

What the best method to detect the player(node/mesh) attack ?

Im using md2 models.

What the logic used to detect when the player attack other ?

Can anyone help me?

Posted: Sun Sep 27, 2009 10:47 pm
by Lonesome Ducky
Not totally sure what you're getting at here. Usually you're the one with the variable of whether or not they're attacking. Or are you trying to determine if they hit something?

Posted: Mon Sep 28, 2009 1:14 am
by 3DModelerMan
I used the bounding box of my characters sword, and checked it against the bounding box of the enemy object. You could make the weapon bounding box bigger and check if the enemy position is in the box as an alternative. But if you're checking for bullet hits I havn't gotten to projectiles yet so I wouldn't know.

Posted: Mon Sep 28, 2009 2:41 am
by Lonesome Ducky
You could also cast a ray of a certain distance forward from the player and see if it intersects the enemies bounding box.

Posted: Mon Sep 28, 2009 4:35 am
by prchakal
Yeah, i think it, check the bounding box of sword, but the sword is built with the player model (md2), can i take only the sword?

How you do to attach wepaons at the model hand? What the technics is used?

Can you explain to me how to attach the sword or weapon and get a bounding box of this sword/weapon in md2?

Posted: Mon Sep 28, 2009 6:34 pm
by Daniel FF
Hi,
you could keep character and sward separated, just using same pivot at models and synchronized animation frames.

But, why not just test the distance between nodes? I think you dont need collision in this case, if an node atack and distance from another node is < 18 (for example) you got a hit.

Sorry for my bad engilsh!

Posted: Mon Sep 28, 2009 7:12 pm
by Murloc992
prchakal wrote:Yeah, i think it, check the bounding box of sword, but the sword is built with the player model (md2), can i take only the sword?

How you do to attach wepaons at the model hand? What the technics is used?

Can you explain to me how to attach the sword or weapon and get a bounding box of this sword/weapon in md2?
Well You need to attach the sword to character's palm joint and make it sword's parent, so it can share rotation and location. Then you can check sword collision with other character :)

Posted: Mon Sep 28, 2009 7:30 pm
by prchakal
@Daniel FF
The problem is not to check is to determine when the player is in attack mode, i think that i can by the frame number, but it a poor implementation, so i prefer the colision with sword.

@Murloc992
Humm ok.

You have a joint tutorial or demo that i can check how to do it with player and weapon?