Ejemplo n.º 1
0
    void LateUpdate()
    {
        transform.position = player.transform.position;
        //transform.position = player.transform.position + offset;

        /*
         * ROTATION OF THE CAMERA
         */

        tiltAroundZ += Input.GetAxis("Mouse X") * sensitivityX;
        tiltAroundY -= Input.GetAxis("Mouse Y") * sensitivityY;

        if (tiltAroundY > 25)
        {
            tiltAroundY = 25;
        }
        if (tiltAroundY < -71)
        {
            tiltAroundY = -71;
        }

        Quaternion target = Quaternion.Euler(tiltAroundY, tiltAroundZ, 0);

        // Dampen towards the target rotation
        transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * smooth);

        /*
         * ROTATION OF THE CAMERA
         * END
         */

        // call here for smoother camera flow
        camAngCont.AngleControl();

        camRotCont.CameraRotate();

        //Debug.Log("Tilt val: " + tiltAroundY);
    }