Search Unity

Melee combat scripting - Colliders, raycasting or other options?

Discussion in 'Scripting' started by Deadlyapples, Mar 21, 2018.

  1. Deadlyapples

    Deadlyapples

    Joined:
    Dec 30, 2013
    Posts:
    54
    So I understand both of these concepts for use with a melee and ranged combat system but I am wondering are there other ways of useful information and techniques that some of you guys use for doing melee stuff. The game I am working on needs to have a solid melee combat foundation but I am not sure which is the best method.

    To me using raycasting seems like a more simple way because then all combat could use the same raycasting method with variables to adjust the range and maybe raycasting arcs, the other option is attaching colliders to all melee weapons, this way when the character swings any weapon if the weapon edge hits something it can trigger the damage that way.

    Any thoughts guys?
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    I would go with trigger colliders instead of raycasting on this one
     
  3. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Depends a lot on the genre / gameplay of your game.
     
  4. Deadlyapples

    Deadlyapples

    Joined:
    Dec 30, 2013
    Posts:
    54
    3rd person action combat with fixed camera controlled character, like over the shoulder locked shooter but for melee