# Combat Feel and Hit Feedback A hit that does not *feel* like a hit is just a number going down. This series is the Unity 6000.5 path for **Level Up! Level 10** ("The Elements of Combat"): attack strings and cancel windows on the Animator, separated **hitboxes** and **hurtboxes**, a short **hit-stop**, camera Impulse, VFX and audio, and a dodge with **i-frames**. It sits on top of [[Animation Advanced]] (the combat Sub-State Machine and event hooks) and [[5.Damage Formulas]] (the math). This note is the juice. **Target:** Unity **6000.5+**, built-in 3D physics (PhysX), Input System, Animator / Mecanim. Camera shake uses **Cinemachine 3.1.x** (`com.unity.cinemachine`; the Unity 6000.5 package page lists **3.1.7** as released - confirm in Package Manager). For a Quest 2 / VR combat lesson, build in **Unity 6.3 LTS (6000.3.27f2+)** ([[0.Choosing a Unity Version]]) and read the VR notes in part 7: you generally do **not** shake the tracked eye cameras. > [!warning] Code not compiled > Scripts were checked against the Unity 6000.5 Scripting Reference (`Time.timeScale`, `Animator` / `AnimatorStateInfo`, `AnimationEventInfo`, `Physics.OverlapBoxNonAlloc`, `Rigidbody.linearVelocity`) and Cinemachine 3.1 Impulse docs. **They have not been compiled or play-tested in Unity.** Confirm trigger/query behaviour and Animator parameter names in your Editor. > [!note] Verification status > **Verified (6000.5 docs, 2026-11-10):** `Time.timeScale` (takes effect next frame; at 0, `FixedUpdate` and `WaitForSeconds` do not run; if you also want physics to keep a steady *real-time* step, multiply `Time.fixedDeltaTime` by the new scale - official example); `Animator.SetTrigger` / `ResetTrigger` / `SetInteger` / `GetCurrentAnimatorStateInfo`; `Animator.CrossFadeInFixedTime`; `AnimatorStateInfo.normalizedTime`; `AnimationEvent` and allocation-free `AnimationEventInfo` callbacks; `Physics.OverlapBoxNonAlloc` (same NonAlloc pattern as [[3. Layers Matrix and Queries]]); `CinemachineImpulseSource.GenerateImpulse` / `GenerateImpulseWithVelocity` / `GenerateImpulseWithForce` (`Unity.Cinemachine`, package 3.1.x); `VisualEffect.SendEvent` / `Play`. > **Not verified:** whether every 6000.5 `Awaitable` helper has a `CancellationToken` overload (the loops below use `NextFrameAsync()` and check the token themselves); exact Inspector labels for Animator Interruption Source in your Editor; AudioSource pitch-vs-`timeScale` behaviour with your mixer setup (flagged as a pitfall). ## Parts | # | Note | Covers | |---|---|---| | 1 | [[1. Combat Feel and the Hit Pipeline]] | The Level 10 contract: windup, active, recovery; a single hit event | | 2 | [[2. Animator Attack Strings]] | Combo buffer, cancel windows, attack ids, CrossFade vs triggers | | 3 | [[3. Hitboxes and Hurtboxes]] | Layers, animation events, overlap queries, one-hit-per-swing | | 4 | [[4. Hit-Stop Knockback and Feedback]] | Feel clock vs `Time.timeScale`, Impulse, VFX, audio, knockback | | 5 | [[5. I-Frames Dodge and Guard]] | Dodge state, invulnerability windows, a simple guard | | 6 | [[6. Worked Example Three-Hit Melee]] | Wiring a 3-hit string, a dummy, and the feedback stack | | 7 | [[7. Combat Feel Pitfalls]] | Double hits, timeScale traps, VR shake, leftover triggers | ## Design lens (Level Up!) Level 10 in [[Level Up! (Review)]] is "The Elements of Combat": melee strings ("And a One and a Two," "The Big Finish"), weapons, defense, dodging and guarding, hit reactions ("Where Doesn't It Hurt?"), and death that *keeps them playing*. Status effects belong in [[2.Modifiers and Timed Buffs]] ("always strive to enable the player, even when you're disabling them"). The design test for this series is simple: a student should be able to land hit 1, cancel into hit 2 in the window, feel the stop and the shake, and dodge through an enemy swing on i-frames - without looking at the Inspector. ## Patterns used (Game Programming Patterns) - **State** - combat, hitstun, dodge and guard are states; the Animator Sub-State Machine mirrors the C# brain ([[5.Sub-State Machines Combat Locomotion]], [[Enemy AI State Machine]]). - **Type Object** - `AttackDefinition` ScriptableObjects are the data for each swing ([[ScriptableObject Architecture]]). - **Observer / Event Queue** - a hit is one event consumed by damage, feel, audio, VFX and UI; nothing polls health every frame. - **Component** - hitbox, hurtbox, feedback and motor are separate components on the same actor. - **Object Pool** - impact VFX and one-shots go through a pool ([[2. Pooled AudioSource Service]], [[VFX Graph]]), not `Instantiate` on every hit. See [[Game Programming Patterns (Review)]]. ## Related (existing) - [[Animation Advanced]] / [[5.Sub-State Machines Combat Locomotion]] / [[6.Animation Events Reliable Patterns]] - the Animator graph this series fills in - [[Input System]] - Attack, Dodge, Guard actions - [[Physics 3D]] / [[3. Layers Matrix and Queries]] - layers, triggers, NonAlloc overlaps - [[Character Controllers]] - knockback has to be consumed by the motor you already wrote - [[5.Damage Formulas]] / [[Stat-Driven RPG Systems]] - damage math, not feel - [[Cinemachine 3]] / [[4.Impulse Noise and Extensions]] - Impulse Sources and Listeners - [[VFX Graph]] / [[3. Worked Effect - Impact Sparks with One Graph]] / [[Particle Systems and Layered Effects]] - [[Post-Processing]] / [[3. Worked Example - Grade Damage and a Cave]] - a hurt volume is feedback, not the hit itself - [[Audio Mixers and Character Audio]] / [[Interactable Audio]] - [[Async Code]] - unscaled waits for hit-stop; cancel on destroy - [[Boss Battles with Phases]] - the same pipeline, at arena scale - [[Hazards, Traps and Key-Door Puzzles]] - telegraphed damage uses the same hurtbox - [[Multiplayer with Netcode for GameObjects]] - who is allowed to confirm a hit is a netcode problem; do not "fix" it with a client-side overlap - [[6. Quest Performance Budgets]] / [[Meta Quest 2]] - no HMD Impulse ## Sources - `Time.timeScale` (6000.5): https://docs.unity3d.com/6000.5/Documentation/ScriptReference/Time-timeScale.html - `Animator` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/animator - Animation parameters (6000.5): https://docs.unity.com/en-us/engine/6000.5/manual/animation-section/animation-mecanim/animation-animator-controller/animation-state-machines/animation-parameters - `AnimatorStateInfo` (6000.5): https://docs.unity3d.com/6000.5/Documentation/ScriptReference/AnimatorStateInfo.html - `AnimationEventInfo` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/animationeventinfo - `Physics.OverlapBoxNonAlloc` (6000.5): https://docs.unity3d.com/6000.5/Documentation/ScriptReference/Physics.OverlapBoxNonAlloc.html - Cinemachine package for 6000.5 (released 3.1.7): https://docs.unity.com/en-us/engine/6000.5/manual/packages-list/packages-all/pack-safe/com-unity-cinemachine - `CinemachineImpulseSource` (3.1): https://docs.unity3d.com/Packages/[email protected]/api/Unity.Cinemachine.CinemachineImpulseSource.html - `VisualEffect.SendEvent`: https://docs.unity3d.com/Documentation/ScriptReference/VFX.VisualEffect.SendEvent.html - `VisualEffect` (6000.5): https://docs.unity3d.com/6000.5/Documentation/ScriptReference/VFX.VisualEffect.html