Exemplo n.º 1
0
    // Update is called once per frame
    public void Update()
    {
        float deltaTime     = Time.deltaTime;
        float lerpDeltaTime = deltaTime * _lerpRate;

        System.Numerics.Vector3 prevPosition = _position;
        _position          = System.Numerics.Vector3.Lerp(_position, _targetPosition, lerpDeltaTime);
        transform.position = _position.ToUnity();

        _velocity = (prevPosition - _position) / deltaTime;
    }