lookAt on Y axis only

i know this question has been asked before but i didn’t work in the script i’m using, i need the transform variable “turret” to look at the transform variable “target” only on the Y axis based around the current script part i’m using:


thanks :slight_smile:

maybe not the most efficient, but a working solution:

Vector3 eulerBefore = turret.transform.eulerAngles; // or localEulerAngles, dependent on your needs
eulerBefore.y = turret.transform.eulerAngles.y;
turret.transform.eulerAngles = eulerBefore;