Search Unity

How to make enemy look at player in 2D TOP DOWN game?

Discussion in 'Scripting' started by KyleStank, Apr 2, 2015.

  1. KyleStank

    KyleStank

    Joined:
    Feb 9, 2014
    Posts:
    204
    Hello,

    I am making a simple 2D top-down shooter game. I need to enemy to look at the player and follow the player wherever he is. I know this has been asked before, but I CANNOT seem to figure this out. Since this is 2D, the only axis that should be rotated is the Z axis. I cannot seem to figure this out, please help!
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
  3. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    LookAt() rotates on the y, if you consider a flat plane. Therefore, why not make your flat plane xz?