Fighting

70a4cb133d26eb6c63bff857b2a44bef
0
rajesh_kumar 101 Oct 29, 2009 at 11:53

Hi to all,
Any one know how to do fighting in 3D(Detecting collisions for punch and kick).My entities having bounding box for each bone and also have overall one.
If anyone knows any pointers towards this please help me.

Thanking You
Rajesh

13 Replies

Please log in or register to post a reply.

1766067da5ff92962fb82e5b1f63a2a4
0
tyree 102 Oct 29, 2009 at 15:00

thats the only way I know to do it. you may not need one for every bone but you have the general idea right for fighting games

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Oct 29, 2009 at 18:58

One way to do it is to model your characters with sphere’s and/or ellipsoids since it’s relatively easy to calculate collisions using those. You can also apply a hierarchy of bounding spheres to group sections of the body. I’m not sure how useful bounding boxes are since it’s hard to make them AABB in the case of moving characters, but I can’t say for sure without a better description of what you are doing.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Oct 29, 2009 at 19:25

Another option, which a lot of fighting games use, is to reduce your testing to 2D polygons, not your typical 3D bounding box.

70a4cb133d26eb6c63bff857b2a44bef
0
rajesh_kumar 101 Oct 30, 2009 at 08:11

Thank u guys

Alphadog
I am using third person view camera.it is possible to convert 2d polygons for checking collisions.

Using spheres for collision between two bones is ok.But how to detect direction of the object hit.Example(object is standing and facing north direction i am punching the object from south direction(behind)).

Please help

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Oct 30, 2009 at 11:30

Could be done in even simpler way. Check collisions by distance and attack style (i.e. kick reaches further than hit). With a little tweaking (and lots of flashy graphics), you can get away with almost anything..

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Oct 30, 2009 at 12:08

Could be done in even simpler way. Check collisions by distance and attack style (i.e. kick reaches further than hit). With a little tweaking (and lots of flashy graphics), you can get away with almost anything..

I haven’t played a lot of these games, but the ones I did seemed to use this style. It was a matter of timing. If the character was in the forward part of the swing, you need to be in a block. If he was in the rearward part of the swing then you need to punch in order to score. I guess it would depend if you were using preset animations or physics based. Physics based might get pretty complicated. Nothing has to be that perfect because it’s happening pretty fast. Personally, I think having some type of rules that the player can understand would be more important.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Oct 30, 2009 at 13:02

@rajesh kumar

I am using third person view camera.it is possible to convert 2d polygons for checking collisions.

Yes, it is possible. Games like Street Fighter and Doom operate this way. You can project 3D into 2D and collision test from that. There are a lot of tuotrials on the net on this.

Also, if you need a lot of power and/or if you also need to introduce physics, you can always use a library like SOLID, Box2D or Bullet (3D).

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Oct 30, 2009 at 14:33

You can figure it out yourself. collision detection is easiest with rays and bounding boxes, the box being the person and the ray being the bullet.

But fighting games are probably harder than shooting games.

What you need is per triangle per triangle detection then operate on switched on damage frames and switched off damage frames, and inert and invincible frames.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Oct 30, 2009 at 18:33

@rajesh kumar

Thank u guys

Using spheres for collision between two bones is ok.But how to detect direction of the object hit.Example(object is standing and facing north direction i am punching the object from south direction(behind)).

Please help

Imagine your character is constructed of spheres. For instance 4 intersecting spheres for the forearm; a couple of sphere for the upper chest so forth. You can then group those spheres into a hierarchy by body parts. For instance you can put a sphere around the forearm that contains the four other spheres. This is not a collision sphere it’s simply a container for the others and is used for a rough check. In the same way you have a sphere around the entire character. You just have to make sure it’s big enough so your character animations don’t cause any sub-spheres to go outside of it. Doing it this way you don’t use bounding boxes at all; AABB or otherwise. I use a similar system for my terrain and it works well.

Spheres are nice in 3D because it is inherently easy to calculate collisions between them. If you increase the radius of one sphere by the one you are checking it with, you now have a point sphere collision test. You can then sweep a point by some increment according to your animation to do the collision. Keep in mind that checking two moving objects is the same as holding one steady and moving the other one. It’s all relative.
As for the direction of the hit, if a point hits a sphere simply generate a vector from the centre of the sphere to the contact point.

There are a lot of details to all this. Doing full 3D animated characters with real collisions is non-trivial. Check out http://www.naturalmotion.com/ for some truly impressive stuff. Good luck.

1766067da5ff92962fb82e5b1f63a2a4
0
tyree 102 Oct 31, 2009 at 10:44

with the facing direction why not use a one sided plane behind the character that could be used as the back of the character. and let you know when something is behind. but keep everything as simple as possible. do not get bogged down in the tech or a long programming outing that keeps extending the time it takes for you to make it. you could end up not making it because of that

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Oct 31, 2009 at 12:37

Yeh, Tyree is right. keep it simple in always works.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Nov 02, 2009 at 16:03

It is possible to have a collision detection system that is too simple.

In a fighting game (I’m assuming a Street Fighter kind of game) having inaccurate detection can be quite detrimental because, quite frankly, the whole game is centered on collision detection. Players won’t know enough to specifically point to the faulty oversimplified CD, but it will play a role in their dissatisfaction.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Nov 03, 2009 at 09:01

Yeh definitely, its not quite what I meant, it still has to be passable of course.