title: throw game object along the curve with a swipe
body: <p>I'm making a mobile game in Unity3D. And there I wanted to make it so that I could throw object along the curve with a swipe. If I do it with AddForce, it only flies in a straight line, and I want it to spin like in the <a href="https://i.stack.imgur.com/N4UZo.jpg" rel="nofollow noreferrer">photo</a>. Help, please</p>
  <p>In this case object flies in a straight line</p>
  <pre><code>void OnMouseDown()
  {
   //get soccer ball starting position when swiping
   startPos = Input.mousePosition;
   startPos.z = transform.position.z - Camera.main.transform.position.z;
   startPos = Camera.main.ScreenToWorldPoint(startPos);
  }
  
  void OnMouseUp()
  {
   //get soccer ball end position when swipe finished
   Vector3 endPos = Input.mousePosition;
   endPos.z = transform.position.z - Camera.main.transform.position.z;
   endPos = Camera.main.ScreenToWorldPoint(endPos);
  
  //get the proper direction and z force
  Vector3 force = endPos - startPos;
  force.z = force.magnitude * 3;
  force.x = force.x * 1.5f;
  
  //check if you swiped (not just clicked) and if ball had not been fired already
  if (startPos != endPos &amp;&amp; GetComponent&lt;Rigidbody&gt;().isKinematic == true)
  {
      GetComponent&lt;Rigidbody&gt;().isKinematic = false;
      GetComponent&lt;Rigidbody&gt;().AddForce(force * Force);
      gameObject.transform.Rotate(new Vector3(0, 0, force.z / 3));
      
      //destroy ball after some time and add a new one to shoot
      StartCoroutine(destroyBall());
      StartCoroutine(newBall());
  }
  </code></pre>
  <p>}</p>