Character Punching in 3D

Blitz3D Forums/Blitz3D Programming/Character Punching in 3D

Nexinarus(Posted 2014) [#1]
I was just wondering if anyone could give me some ideas on how to go about coding Punching in 3D. More specifically, the collision of a fist to the victims body.

Ive seen lots of blitz3d code on shooting projectiles, I get the concept of that but nothing is done with punching or kicks... Hand to hand combat type stuff.

Does anyone have any pointers. I am still in the planning stage but any tips or tricks on a way to go about it would be of great help.


RemiD(Posted 2014) [#2]
I see 2 approaches to do this :

Without colliders and collisions :
All you need to know is if a characterA is near enough characterB, and if the characterB is in front of the characterA. Now you know if the characterA can attack the characterB.

You may want to consider several kinds of attacks depending on the posture of characterA (On the ground ? crouching ? standing up ? On the air (while jumping or while falling) ?) and depending on the posture of the characterB.

With this you don't need colliders and collisions because you will know exactly which animation to play.


With colliders and collisions :
You can put a collider emitter (with entityradius) where each fist of your characterA is, and when the characterA is attacking with a fist, check if there is a collision between the collider emitter of the fist of the characterA and the collider receiver of the body of the characterB.
You can also add different colliders receiver on the different parts of the body of each character so that you know which animation to play when a character has been hit (in the legs ? in the belly ? in the chest ? in the head ?)

That's how i would do it.


Matty(Posted 2014) [#3]
That depends on how much detail you want?

Something like an old school beat em up like Golden Axe in 3d or I guess as little detailed as say Diabo - you don't need any collision, just detect when near, when facing if the animation frame is at the end of the punch motion and subtract damage!

If you want something like a first person boxing game with details such as where you hit the person...then yes you will need to worry about collisions and perhaps even physics!


Nexinarus(Posted 2014) [#4]
thanx for the input. I tried collisions with 3d objects and was a bit frustrated with the results. I am going to try some of your guys i ideas.