Scale + Translate transform at same time

Hi guys

I am looking for a solution to create a ball movement which transforms by scale at the same time as movement (simulating a 2d ball flight). At the moment this is an example of my code which only contains the translate movement in a coroutine.

IEnumerator ServeA () {

        while (Vector2.Distance(ball.transform.position, serve_left_position[4]) > 0.01f) {
            ball.transform.position = Vector2.MoveTowards(ball.transform.position, serve_left_position [4], transitionspeed * speedmodifier * Time.deltaTime);
            yield return null;
        }

Is there a way to combine it easily into this script or will I have rework the code? Maybe even recommend an asset which will make my job easier?

Thanks in advance!

Aden

Perhaps something like this…

float t = 0.0f;

while( t < 1.0f )
{
      ball.transform.position = Vector2.Lerp( originalPostion, newPosition, t );
      ball.transform.scale = Vector2.Lerp( originalScale, newScale, t );
      t += Time.deltaTIme;
      yield return null;
}

Scaling and transform are done with 2 separate matrices but you can bake them together without a problem.
Rotating and translating can not be done at the same time since depending on what you do first you will get different results.

Technically, transform and scale can be done in the same matrix, where the last column is the translation vector and the diagonal is the scalling vector.

NOTE: The dimension of the matrix should be one more dimension of the vectors you are working with.