Added a function that calculates the velocity of the object when released.