rotation of camera doesn't work

Can’t find how to rotate the camera when transforming to a new position and look at a target.
The transform to the target position works, the rotation doesn’t.

I made this script in the FirstPersonControler:

public Transform Target;
    public Transform Target2;

    public Vector3 mainCamera;

    void Start()
    {
        mainCamera = transform.position;
    }

    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "FireFXFlameBall01")
        {
            transform.position = Target.position;
            transform.LookAt(Target2);
        }
    }

Tried:
transform.rotation = Quaternion.identity;
transform.rotation = Quaternion.Euler(0,0,0);

Someone to help me out.

If you want to rotate the camera you have to use the transform of the camera.

Hmm, it doesn’t work there also.
My script to rotate:

public Transform Target;


    void Start ()
    {
    }

 
    void OnTriggerEnter(Collider col)
    {

        if (col.tag == "FireFXFlameBall01")
        {
            transform.LookAt(Target);
        }
      
    }

Is there something wrong about it.

This script, if attached to a the camera (assuming that camera has a collider set as trigger and has a rigidbody), will make the camera look at target if the camera collides with an object tagged as “FireFXFlameBall01”. Is that what you want to do?

What I wan’t to create is when the FPScontroler have a collision with an object, the FPScontroler goes to the new location called as Target witch I moved an empty object in (in the inspector), this works great.
When moved to the place the camera looks at the wrong side, so I thought I create an other target called target2 and move the object I want to look at in it (in the inspector).

So the FPScontroler does move to the new location but doesn’t rotate looking at the object.
I tried to make such script in the maincamera aswell, but this doesn’t work.

I made this script in the FPScontroler:

public Transform Target;
    public Transform Target2;

    public Vector3 mainCamera;

    void Start()
    {
        mainCamera = transform.position;
    }

    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "FireFXFlameBall01")
        {
            transform.position = Target.position;
            transform.LookAt(Target2);
        }
    }

Can you help me to tell where it goes wrong or why it doesn’t work.

Need some help.

Thanks.