Let’s look at the implementation first:

I did it months ago just a few lines of critical code

Private void PrepareDots() {dotsList = new Transform[dotsNumber]; private void PrepareDots() {dotsList = new Transform[dotsNumber]; dotPrefab.transform.localScale = Vector3.one * dotMaxScale; float scale = dotMaxScale; float scaleFactor = scale / dotsNumber; for (var i = 0; i < dotsNumber; ++i) { dotsList[i] = Instantiate(dotPrefab, null).transform; dotsList[i].parent = dotsParent.transform; dotsList[i].localScale = Vector3.one * scale; if (scale > dotMinScale) scale -= scaleFactor; }}Copy the code
Public void UpdateDots(Vector3 ballPos, Vector3 ballPos, Vector3 ballPos, Vector3 ballPos, Vector3 ballPos, Vector3 Vector2 forceApplied) { timeStamp = dotSpacing; For (var I = 0; i < dotsNumber; ++i) { pos.x = (ballPos.x + forceApplied.x * timeStamp); pos.y = (ballPos.y + forceApplied.y * timeStamp) - (Physics2D.gravity.magnitude * timeStamp * timeStamp) / 2f; dotsList[i].position = pos; TimeStamp += dotSpacing; //timeStamp time}}Copy the code

This line of code can actually be considered as a physical flat throw motion.

Like to use Unity to do online game development friends can have a look