Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Game-Dragon · May 04, 2013 at 09:31 AM · collision2.5dhitboxfighting

Hit detection for Fighting Games?

Hello all. I am a bit confused on how I should be approaching this. I'm interested in starting a 2.5D Fighting game, similar to modern Capcom fighters like Street Fighter IV. I am wondering how I would go about creating a type of hitbox detection used in these games. Here are some images for reference.

alt text alt text

Fighters of this nature generally have very specific, hand-done hit boxes used for collision. My first thought was to add Box Colliders to different parts of my armatures, but I felt it was a bit inaccurate. Hitboxes tend to usually be bigger than the body part they are mimicking, or in the case of the second screenshot, don't follow the body at all.

Anyone have any suggestion they can throw my way?

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bluk · May 04, 2013 at 01:11 PM 0
Share

Hey,

I'm not sure i get what you are asking right, so let me ask a few questions: What is the difference between the red and green box? Did you try mesh collider?

avatar image Game-Dragon · May 04, 2013 at 01:37 PM 0
Share

In the example above, the green box would be the "hurtbox", hitting any part of that box would deal damage to the character. The red one is sometimes called a "strikebox", this is the area or range your attack represents. These hitboxes are dependent on the character animation and constantly change in size and quantity.

Basically, If YOUR strikebox (red) collides with a opponent's hurtbox (green), you will deal damage to them. I'd like to recreate a system like this. A bit unnecessary ter$$anonymous$$ology, I'm sorry. Just trying to be a bit more clear.

These boxes are represented in 2D, not 3D. I am not exactly sure how a mesh collider would assist me in this case. $$anonymous$$aybe you could elaborate?

avatar image Bluk · May 04, 2013 at 01:55 PM 0
Share

Ok, i understand a bit better now. The ter$$anonymous$$ology is necessary though, since in my opinion the hurtbox is not the same thing as the strikebox.

Basically what you want here is that a character's strikebox only collides with another player's hurtbox. For this you might need to look at the layer based collision detection (http://docs.unity3d.com/Documentation/Components/LayerBasedCollision.html ).

I mentionned the mesh colliders because you said that box colliders were inaccurate, and it is a way to improve your accuracy. It might be a way to have your colliders match your model (for example for the foot).

As for the colliders in 2D or 3D, it's basically the same, but since your character models are in 3D, i would recommend to have the colliders in 3d as well, because it might be more accurate.

So tu sum up: 2 different colliders (hurtbox and strikebox) The strikebox can collide only with hurtbox Define the colliders as you want depending on the accuracy you need.

avatar image Game-Dragon · May 04, 2013 at 02:10 PM 0
Share

Thanks a lot for the response. =)

Box colliders being "inaccurate" was the wrong term for me to use. Hitboxes tend to be very exaggerated in most fighting games.

Quick example: A opponent that is crouching would logically have a smaller hitbox. In a realistic fighting game, any attacks that would normally aim for the head, such as a roundhouse kick, would completely miss. However, in a 2D fighter such as Street Fighter, this attack would still connect because the strikebox is much larger and exaggerated than the limb it is actually representing. Which is why using a mesh collider confused me a bit.

$$anonymous$$y question now would be how would I go about creating these boxes, based on the animation of the character.

avatar image Bluk · May 04, 2013 at 02:28 PM 0
Share

You need to attach the collider to a specific joint in the skeleton hierarchy of your character. For example, attach a strikebox to the foot of the character. This way, it will move with the feet.

That's for basic hitting purposes (kicking, punching, etc.). If you want to do something like for blanka, you need to control the switching between strike colliders in your control scripts (for instance disabling normal strikebox to enable a larger one when you do the electricity thingy).

It all depends on what exactly do you want to do.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Max_Bol · Jun 05, 2015 at 11:08 PM

Even if this is 2 year old, I would like to give some tips considering that I found it at the top of Google listing.

Like some others have mentioned, a way of doing this is by using mesh or box collides linked to each body's parts.

Personal, there's what I would suggest :

1) For the hurt box (which we tend to call "Hit box"), uses box colliders on every major bones from the rig. Don't do each fingers or toes for the sake of the players' CPU.

2) I would advise also to put each player to a different layer so, that way, you can make sure that each player can't harm himself. Unless you're planning a 16 vs 16 fighting game (which would be quite chaotic) you can keep each player on a different layer (and literally name those "Player1", "Player2", etc.)

3) For the strike box (Which we tend to call "Attack area"), you could uses a box collider or capsule collider if you wish for a bit more "smooth" cornered strike box. If you did the step 2 of putting every players on a different layer, you can easily make it so that each Strike box can ignore (or not) the player's own layer. It's especially useful if you got some magical attacks that uses some particles.

I'm currently working on an early version of a game that seems similar to Super Smash Bros and that's how I'm doing it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Hit Detection Issues with multiple colliders on 1 mesh? 1 Answer

2.5D Shmup, how to create bullets on "camera plane"? 0 Answers

Get Object ID upon collision. 1 Answer

Drawing Rectangles in 2D for hitboxes: fighting game 1 Answer

Hit detection for Street Fighter Game 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges