Jump to content


- - - - -

Fighting


13 replies to this topic

#1 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 29 October 2009 - 11:53 AM

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

#2 tyree

    Valued Member

  • Members
  • PipPipPipPip
  • 318 posts

Posted 29 October 2009 - 03:00 PM

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

#3 SyntaxError

    Valued Member

  • Members
  • PipPipPip
  • 139 posts

Posted 29 October 2009 - 06:58 PM

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.

#4 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 29 October 2009 - 07:25 PM

Another option, which a lot of fighting games use, is to reduce your testing to 2D polygons, not your typical 3D bounding box.
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#5 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 30 October 2009 - 08:11 AM

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

#6 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 519 posts
  • LocationNowhere whenever

Posted 30 October 2009 - 11:30 AM

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..
http://iki.fi/sol - my schtuphh

#7 fireside

    Senior Member

  • Members
  • PipPipPipPip
  • 1620 posts

Posted 30 October 2009 - 12:08 PM

Quote

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.
Currently using Blender and Unity.

#8 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 30 October 2009 - 01:02 PM

rajesh kumar said:

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).
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#9 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2759 posts

Posted 30 October 2009 - 02:33 PM

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.
you used to be able to fit a game on a disk, then you used to be able to fit a game on a cd, then you used to be able to fit a game on a dvd, now you can barely fit one on your harddrive.

#10 SyntaxError

    Valued Member

  • Members
  • PipPipPip
  • 139 posts

Posted 30 October 2009 - 06:33 PM

rajesh kumar said:

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.

#11 tyree

    Valued Member

  • Members
  • PipPipPipPip
  • 318 posts

Posted 31 October 2009 - 10:44 AM

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

#12 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2759 posts

Posted 31 October 2009 - 12:37 PM

Yeh, Tyree is right. keep it simple in always works.
you used to be able to fit a game on a disk, then you used to be able to fit a game on a cd, then you used to be able to fit a game on a dvd, now you can barely fit one on your harddrive.

#13 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 02 November 2009 - 04:03 PM

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.
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#14 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2759 posts

Posted 03 November 2009 - 09:01 AM

Yeh definitely, its not quite what I meant, it still has to be passable of course.
you used to be able to fit a game on a disk, then you used to be able to fit a game on a cd, then you used to be able to fit a game on a dvd, now you can barely fit one on your harddrive.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users