How to add acceleration to object on mouse up or release press?

Hi,

I need help on how to make objects in a 2d mode move with a little acceleration to the direction on mouse up.

So basically what I’m trying to do is if I drag the object to the upper right and let go, I want the object to go the same direction (upper right) before dropping (lower right).

Here’s what I have so far. I’m able to hold and drag and let go of the object. The only problem is that when I let go, it drops straight down.

void OnMouseDown() {
    offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
}

void OnMouseUp() {
	Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
    Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
	rigidbody.velocity = curPosition;
}

void OnMouseDrag() {
    Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
    Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
    transform.position = curPosition;
}

maybe save the mouse position every few frames the object is being held

void Update()
{
      if (objHeld == true && Time.frameCount % 3 == 0)
      {
           savedMousePoz = mousePosition;
      }
}
//then 
void OnMouseUp() 
{
       rigidbody.velocity = (mousePosition - savedMousePoz) * adjustmentFloat * time.deltaTime;
}

or something to that effect – may have to change the formula a bit to get it to work