Search Unity

Which is best for AI hitting player?

Discussion in 'Scripting' started by Josenifftodd, Dec 5, 2014.

  1. Josenifftodd

    Josenifftodd

    Joined:
    Nov 29, 2013
    Posts:
    158
    Which is the best way of doing this I want to go with what I know

    1) make it so that once an enemy is a sphere collider i make a boolean tick attack and the AI animates and attacks

    2) use a raycast to see distance and then attack with animator>boolean

    when AI hits will it be my mesh collider I use to take the attack or would I make sphere colliders on objects on certain points of my player so say head, arm, leg have sphere colliders?
     
  2. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,357
    I'm mostly clueless on scripting ,so far, but most efficient way should be 2 put 2 colliders on mobs one for collision detection( () ) and the other as a istrigger(box circle etc) with a larger radius to represent the distance at which the mob will activate(triggered action).with rays it has to be always checking and in multiple directions a istrigger does not.

    As for diff body parts guess if u want to take damage to various parts instead of a whole then maybe but else a single collider is prolly better.
     
  3. Josenifftodd

    Josenifftodd

    Joined:
    Nov 29, 2013
    Posts:
    158
    Cheers man this was for a real time battle system but decided to a do a turn base battle system so all is good :)