Search Unity

Headshot

Discussion in 'FPS.Sample Game' started by IanHonorato, Jun 6, 2019.

  1. IanHonorato

    IanHonorato

    Joined:
    Apr 9, 2019
    Posts:
    6
    I'm trying without sucesses to set a colisor for headshots
     
  2. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    54
    There is already a collider for the head but a detection for headshots are not implemented by Unity for this sample.
    So you will need to have to do that yourself.

    Once you check if a shot has hit anything you can do an extra check to see what it hit.
    Each player model uses their own collider model and this already has colliders for each body part.

    In our game we have 5 different zones on the player models body with different damage multiplier including a headshot detector.

    I can't remember which files were changed but it shouldn't be that hard to find.
     
  3. nanoblubb

    nanoblubb

    Joined:
    Oct 29, 2016
    Posts:
    9
    Do you maybe remember where the damage multiplication happens, when you hit a collider. I could manage to find the part where you set the HitInfo enum to define bodyParts and where the check happens wich body part should be seted. But i could not find the part where this sections are actual used and decisions of the damage output happens depended on the body part of the current hitted collider.
     
  4. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    54
    Then you need to make a bool when the different body parts are hit and send that to each weapon.
    In those weapon scripts you can make an if statement to do different amount of damage either by multiplying the original damage or make more damage vars for each part, like we did.

    We have 5 zones for each weapon and then we set each variable in each weapons asset files.
     
    AggressiveMastery likes this.
  5. minibotan

    minibotan

    Joined:
    Oct 4, 2016
    Posts:
    15
    i think it is better to make enum, not bools
     
  6. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    54
    You can do it however fits your need.
    I'm just pointing in a direction for a solution.
     
    minibotan and AggressiveMastery like this.