Camera follow player while it doesnt block animations

EDIT 18-10

First of all. i did edit my explanation because i think it wasn’t clear enough. let me explain the situation better. i have a simple cameracontrol script what follows the player:

public GameObject player;
    private Vector3 offset;
    void Start() {
        offset = transform.position - player.transform.position;
    }
    void LateUpdate() {
        transform.position = player.transform.position + offset;
    }

i did attach this script to my Main Camera. and my Main Camera is a child of a empty parent. in my empty parent i have the component (legacy)Animations and with those animations i control the main camera. well here comes the problem. while my player is moving in my straight line (Z-axis), my Main camera is following but at a specific point it needs to play an animation. it animation says to go in the Y-Axis from 0 to -3 in and in the Z-Axis from localposition(thats why i use a parent) to -1. the animation works in de animation editor but in runtime it won’t. i did ask did but nobody did answer in 3 days. but i actually found the problem but i dont know hot to fix it. the problem is that the cameracontrol script is blocking the animation because the script is using already transform position so it blocks the animation. i tried to animate the rotation and scale and those works perfectly except the position. the question from this story is: do you guys know how to fix it or do you guys know another way to follow the player and doesn’t affect the animations. i did look to a lot of topics and forums for an answer but almost every post i saw was make it a child or use this simple code which i already tried. i hope it’s is clearer now and can hopefully find an answer.

Thanks in advance

Why are you using animations? You could easily achieve this using some code.

Vector3 toRotation = new Vector3(0, -3, -1); // If I understood you correctly
Quaternion currentRotation = transform.rotation;

transform.rotation = Quaternion.Lerp(currentRotation, Quaternion.Euler(toRotation), Time.deltaTime * rotationSpeed);

Or if you mean position:

Vector3 toPosition = new Vector3(0, -3, -1);

transform.localPosition = Vector3.Lerp(transform.position, toPosition, speed * Time.deltaTime);