[solved] Lookat target, rotate Y angle only

Hi

In my script, Object look at me, where ever i go he look at me. but i need him to move right and left only and not look up or down.
Second, can i reduce the mush of a cube to 50% instead disable or enable it ?

    public Transform target;
    public Transform point_position;
    public Mesh cube_mesh;
    public float nearMe;

    // Update is called once per frame
    void Update () {
        gameObject.transform.position = point_position.transform.position;
        transform.LookAt(target);

        nearMe = Vector3.Distance(gameObject.transform.position,target.transform.position);
        if (nearMe <= 2) {
        //    cube_mesh 50% ?!!
        }

    }

Reduce like how? Should it be transparent? → use a material! Should it be cut in half? → You need to cut it in half with a script or something
BTW, these are two separate questions, you need to ask them in two separate threads

Your original problem is pretty easy, you should do something like this:
objectRotation.eulerAngles = objectRotation.eulerAngles.y * Vector3.up;

1 Like

Thank you.
[Solved]