Beispiel #1
0
    void LateUpdate()
    {
        _targetPosition   = _target.transform.position;
        _targetPosition.z = _zAmount;
        _targetPosition.x = Mathf.Clamp(_targetPosition.x, _leftClamp, _rightClamp);

        _wobbleProgress += Time.deltaTime;
        if (_wobbleProgress > _wobbleRefresh)
        {
            UpdateWobble();
        }

        // lerp all the things!
        _currentPosition = Vector3.Lerp(_currentPosition, _targetPosition, _positionSpeed);
        Vector3 _currentWobble = Vector3.Lerp(_oldWobble, _targetWobble, Generics.EaseInOutQuad(_wobbleProgress / _wobbleRefresh));

        transform.position = _currentPosition + _currentWobble + _pan;
    }