Line between 3 points

Hi EveryOne,
First of all thank you very much for Your Support. Your Valuable Suggestion really helped in Game Development. Now, i have another question:-
I have 2 * 3 matrix of bubbles and i want to draw arrows between those bubbles. it should be done in way as in below Image:-

``

What is happening here, When i touch 1 bubble, start point will set to 1 and if i drag my finger towards 2nd bubble, an arrow that is strechable should draw between these 2 points and if i continue to drag my finger from 2 bubble to 3rd bubble, another arrow should draw between 2 and 3rd bubble and continue untill i lift my finger.

Please help me on this or at least give me some suggestion.

Hello,

I think that first of all you should find the direction vector between two bubbles. This way you could transform that direction vector in a quaternion and apply this quaternion as a rotation to the arrow.

For instance, we have bubble1 and bubble2. If you touch the bubble2 after you have touched bubble1 you could find the direction vector this way:

Vector3 dirVector = bubble2.transform.position - bubble1.transform.position;

Then you can find the angle that this direction vector forms with de x Axis:

float angle = Mathf.Atan2(dirVector.y, dirVector.x) * Mathf.Rad2Deg;

And finally you can get the rotation (quaternion) to apply to your arrow this way:

Quaternion arrowRotation = Quaternion.AngleAxis(angle, Vector3.forward);