예제 #1
0
    static public VectorN SmoothDamp(VectorN current, VectorN target, ref VectorN velocity, float acceleration, float deceleration)
    {
        VectorN desiredVelocity = target - current;

        desiredVelocity.magnitude = Mathf.Sqrt((desiredVelocity.magnitude * 2f) / deceleration) * deceleration;
        velocity = VectorN.MoveToward(velocity, desiredVelocity, acceleration);
        return(current + velocity);
    }