Beispiel #1
0
    private void UpdateAnimation()
    {
        var time = Time.deltaTime * Smooth;

        var offset = _focus.GetFocusPosition() - _focus.GetCameraPosition(_3d);

        _offset = Vector3.SmoothDamp(_offset, offset, ref _offsetVelocity, time);

        transform.position = Vector3.SmoothDamp(transform.position, _focus.GetCameraPosition(_3d), ref _positionVelocity, time);

        _rotationUp        = Vector3.SmoothDamp(_rotationUp, _3d ? Vector3.up : Vector3.forward, ref _rotationUpVelocity, time);
        transform.rotation = Quaternion.LookRotation(_offset, _rotationUp);

        Camera.orthographicSize = Mathf.SmoothDamp(Camera.orthographicSize, _focus.OrthographicSize, ref _orthographicSizeVelocity, time);
    }