User Tools

Site Tools


character:hitbox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
character:hitbox [2014/10/25 00:09]
Justin H.
character:hitbox [2022/07/27 03:39] (current)
Mistermind
Line 1: Line 1:
 ====== Hit Box Setup ====== ====== Hit Box Setup ======
-One of the key ingredients of any fighting game are hit boxes. Different than other action games, 2.5D fighting games rely on precision hits in a more "mechanical" way, as it emulates the sensation of playing a 2D game with the precision (and impact) of well adjusted invisible hitboxes.+One of the key ingredients of any fighting game are hitboxes. Different than other action games, 2.5D fighting games rely on precision hits in a more "mechanical" way, as it emulates the sensation of playing a 2D game with the precision (and impact) of well adjusted invisible hitboxes.
  
 There are many types of hitboxes, around, and thanks to the recent use of 3D technology to emulate 2D game play, hitboxes are commonly known for following body joints. Here are some examples: There are many types of hitboxes, around, and thanks to the recent use of 3D technology to emulate 2D game play, hitboxes are commonly known for following body joints. Here are some examples:
Line 10: Line 10:
  
  
-UFE uses a similar technology, in which it detects the distance between 2 points in projected 2D environment and based on the defined radius of the hitbox, determine rather or not a hit should be confirmed.+UFE uses a similar technology: if //hitbox// and a //[[move:activeframes|hurtbox]]// are overlapping then a hit is confirmed.
  
-Similar to Marvel vs Capcom 3 series, UFE uses circles as hitboxes as it uses less processing power and gives you a wider variety of game play to work with.+UFE uses circles and rectangles as hitboxes which gives you a wide variety of game play to work with.  Circles and rectangles can be used simultaneously, UFE will detect hits between any combination of hitbox/hurtbox shapes.
  
-{{:character:character_hitboxes.jpg?nolink|}}+{{ :character:character_hitboxes1.png?nolink |}}
  
-----+Make sure you first set your character model(s) under [[character:prefabs|Character Prefabs]] before proceeding to the sections below.
  
-==== Character Prefab ==== 
-**Choose a character prefab:** A prefab containing the following components 
-  * Animation 
-  * (SOURCE VERSION) Hit Boxes Script (''.\UFE\Scripts\HitBoxesScript.cs'') 
-  * (OTHER VERSIONS) Hit Boxes Script (''.\UFE\Plugin\UFE.dll\HitBoxesScript'') 
- 
-or 
- 
-**Create a character prefab:** Create a character prefab from your character model 
-  * Drag your character model from your project folder to the **Hierarchy** 
-  * If it doesn't have the animation component yet, click on **Add Component**, than search for Animation. No further configuration is necessary. 
-  * Using the Project window, navigate to ''.\UFE\Scripts\HitBoxesScript.cs'' ((''.\UFE\Plugin\UFE.dll\HitBoxesScript'' if you are not using the source version.)) and, with the character still selected, drag the script to the Inspector window. No further configuration is necessary. 
-  * Once you're done, drag the character back from Hierarchy to your desired folder in the Project window. Unity will automatically create a prefab. 
- 
-{{ :character:character_prefab.jpg?nolink |}} 
- 
-Now just drag your nearly created prefab to the //Character Prefab// field under the Character Editor. Once you have your character in, you can click on "Preview" to see the character. Now lets configure the hitboxes. 
  
 ---- ----
- 
 ==== Transform ==== ==== Transform ====
-Works similar to Unity's default Transform component. +Works similar to Unity's default Transform component.  Adjust your character's rotation so it looks like its standing on the left side of the screen.\\
-Adjust your character's rotation so it looks like its standing on the left side of the screen.+
  
 **Notes:** **Notes:**
   * Avoid changing the character's position as it will save its "local position" and it might cause some visual bugs in the future.   * Avoid changing the character's position as it will save its "local position" and it might cause some visual bugs in the future.
   * Even though you can use the standard t-pose as the default animation when importing your character, its recommended that you use the idle animation as your character's default pose/animation. It makes it easier to work with hitboxes, specially if you adjust the character rotation.   * Even though you can use the standard t-pose as the default animation when importing your character, its recommended that you use the idle animation as your character's default pose/animation. It makes it easier to work with hitboxes, specially if you adjust the character rotation.
-  * Make sure you adjust the characters rotation as you would like to see them on screen. 2.5D Fighting games tend to have more "theatrical" pose, in a sense that their body language are constantly facing the camera (or "audience"), while their heads are facing the opponent. +  * Make sure you adjust the characters rotation as you would like to see them on screen. 2.5D Fighting games tend to have more "theatrical" pose, in a sense that their body language is constantly facing the camera (or "audience"), while their heads are facing the opponent.
   * Don't worry about mirroring your animations. UFE will take care of that for you.   * Don't worry about mirroring your animations. UFE will take care of that for you.
  
 ---- ----
- 
 ==== Hit Boxes ==== ==== Hit Boxes ====
-Tag your character's body parts to the hit boxes, set its radius and adjust its behavior.+Tag your character's body parts to the hit boxes, set its shape, size, collision type and hitbox type.
  
-{{ :character:character_hitboxes2.jpg?nolink |}}+{{ :character:character_hitboxes3.png?nolink |}}
  
-  * **Body Part:** A tag representing the body part inside UFE.+  * **Body Part:** A tag representing the body part inside UFE.   
 +  * **Link:** The body part related to the character on screen. Navigate through the mesh and select the bone that best cover the selected body part.  
 +  * **Shape:** Circle or Rectangle shape hitbox. 
 +    * (Circle) **Radius:** How big the hitbox is. Its recommended that yellow hitboxes cover as much ground as possible to avoid unexpected cross-overs during battle. 
 +    * (Circle) **Off Set:** Off set the hit boxes around the character body if needed. Be careful with high values, as different animations can cause unexpected positioning. 
 +    * (Rect) **Rectangle**: X and Y make up the bottom left corner; W and H is the size calculated as distance from X and Y respectively. 
 +    * (Rect) **Follow Bounds (X/Y):** Toggle this if the rectangle shape is to follow the bounds of the character.  Note that this uses Unity's [[http://docs.unity3d.com/ScriptReference/Renderer-bounds.html|Renderer Bounds]].  Adjust W and H to suit.
   * **Collision Type:**    * **Collision Type:** 
     * Body Collider (yellow hitboxes): Movement and hit collision. Opposing yellow hitboxes cannot overlap.     * Body Collider (yellow hitboxes): Movement and hit collision. Opposing yellow hitboxes cannot overlap.
     * Hit Collider (green hitboxes): Hit collision only. Opposing green hitboxes can overlap.     * Hit Collider (green hitboxes): Hit collision only. Opposing green hitboxes can overlap.
     * No Collider (white hitboxes): No collision. Use these for body parts that are not considered hitboxes but can be a [[move:activeframes|hurtbox]] if needed.     * No Collider (white hitboxes): No collision. Use these for body parts that are not considered hitboxes but can be a [[move:activeframes|hurtbox]] if needed.
 +    * Throw Collider (red hitboxes): Used to detect attacks that have hittype of Throw.  If the character doesn't have a Throw Collider hitbox, then throws will not work against them.  See also: [[throwtutorial:throw_tutorial|Throw Creation Guide]]
   * **Hit Box Type:**    * **Hit Box Type:** 
     * High: If a non-knockdown attack hits this hitbox, ''Get Hit High'' animation group is triggered.     * High: If a non-knockdown attack hits this hitbox, ''Get Hit High'' animation group is triggered.
     * Low: If a non-knockdown attack hits this hitbox, ''Get Hit Low'' animation group is triggered.     * Low: If a non-knockdown attack hits this hitbox, ''Get Hit Low'' animation group is triggered.
-  * ** Off Set:** Off set the hit boxes around the character body if neededBe careful with high values, as different animations can cause unexpected positioning. +  * **Default Visibility:** Set the default visibility for certain Game Objects under your character hierarchyThis option is useful for hiding or showing certain objects during gameplay (like weapons)This option only works for objects detached from the main [[http://docs.unity3d.com/Manual/class-Mesh.html|Mesh]]You can then toggle the visibility by using [[move:start|Move Editor -> Body Parts Visibility Toggle]].
-  * **Radius:** How big the hitbox isIts recommended that yellow hitboxes cover as much ground as possible to avoid unexpected cross-overs during battle. +
-  * **Link:** The body part related to the character on screenNavigate through the mesh and select the bone that best cover the selected body part+
  
 **Note:** **Note:**
 +  * Each bodypart should be unique.  If any bodypart doubles up, it can cause strange behaviour with hit detection.  Use Custom 1-9 if you run out of defined ones.
   * If you rigged your model using [[https://www.mixamo.com/c/auto-rigger/|Mixamo Auto-Rigger]] you can click on **Auto-Setup for Mixamo Auto-rigger** to automatically set the hit boxes of your character.   * If you rigged your model using [[https://www.mixamo.com/c/auto-rigger/|Mixamo Auto-Rigger]] you can click on **Auto-Setup for Mixamo Auto-rigger** to automatically set the hit boxes of your character.
   * After the last step if you can't see the hitbox in scene view, click on Gizmos (top right corner of scene view) and toggle "HitBoxesScript".   * After the last step if you can't see the hitbox in scene view, click on Gizmos (top right corner of scene view) and toggle "HitBoxesScript".
  
 +
 +----
 +==== Related Video Tutorials ====
 +{{youtube>2q6HtL9L_GY?large}}
 +
 +{{youtube>6tJ7rPAvt_w?large}}
 +
 +
 +
 +----
 Code example: Code example:
 <code c#>void OnHit(HitBox strokeHitBox, MoveInfo move, CharacterInfo hitter){ <code c#>void OnHit(HitBox strokeHitBox, MoveInfo move, CharacterInfo hitter){
Line 76: Line 72:
 }</code> }</code>
  
----- 
- 
-Related Video Tutorial:\\ 
-{{youtube>large:6tJ7rPAvt_w}} 
  
 ---- ----
  
 [[character:start|< Back to Character Editor]] [[character:start|< Back to Character Editor]]
character/hitbox.1414210164.txt.gz · Last modified: 2014/10/25 00:09 by Justin H.