Search Unity

Enemy boss eyes following the player

Discussion in '2D' started by Orinuvan, Oct 28, 2020.

  1. Orinuvan

    Orinuvan

    Joined:
    Feb 3, 2019
    Posts:
    95
    Hi, so I have this game with a boss battle where the enemys eyes should follow the player inside the eyeballs , like looking at him in real time:

    freesnippingtool.com_capture_20201028153117.png

    I also set colliders on the edges of the eye balls so the pupils wont fall or go in unwanted places.

    Also check this video for more info :



    Sorry for the bad quality of the video, so If you can help me please I would be very thankfull, all the best to you!
     
  2. Dedi6

    Dedi6

    Joined:
    Jan 20, 2019
    Posts:
    119
    You can make the eyes move on the horizontal axis based on the input of the player, but in a reduced speed ofcourse.
    I don't know how you initiate the boss fight, but once you start in have the boss look at the player.
    For instance, I start my boss fight with a trigger, and when the player triggers it stuff happen. So you can set a "startingPoint" for your eyes, and then have them move left and right as I said before.
     
    Orinuvan likes this.
  3. raarc

    raarc

    Joined:
    Jun 15, 2020
    Posts:
    535
    check the angle between the middle of the eyes of the cat and the player. Then choose a max distance the eyes can move to the side and max angle that your character can be for the cat to move his eyes. Then if looking directly down is 0º angle the eyes position will be -

    Code (CSharp):
    1. eyeleft.transform.position = new vector3( angle * (maxDistance/maxAngle), 0,0);
     
    Orinuvan likes this.
  4. Orinuvan

    Orinuvan

    Joined:
    Feb 3, 2019
    Posts:
    95
    I will try this thanks a lot :D
     
  5. Orinuvan

    Orinuvan

    Joined:
    Feb 3, 2019
    Posts:
    95
    I will also try this as a last resort cuz it seem complicated :p thank you !
     
  6. Orinuvan

    Orinuvan

    Joined:
    Feb 3, 2019
    Posts:
    95
    This did it <3
     
    Dedi6 likes this.