title: Spawn bombs and throw them to the player in Unity
body: <p>I got a small arena where the player can move on. At the sides of the area there are spawners. These spawners instantiate bombs and should throw them at the player.</p>
  
  <p>For the direction I actually use</p>
  
  <p><code>transform.lookAt(playerTransform);</code></p>
  
  <p>So this is a rough map</p>
  
  <p><a href="https://i.stack.imgur.com/hqRtO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hqRtO.png" alt="Map"></a></p>
  
  <p>So the spawners are rotating around the map. They move from one point to the next point.</p>
  
  <p>My bomb object got a rigidbody attached and the gravity is activated. I just need to find out how to make a spawner throwing a bomb to the player.</p>
  
  <pre><code>public class BombSpawner : MonoBehaviour
  {
      [Range(0, 3)]
      [SerializeField]
      private int nextPointIndex; // set the first targetpoint
  
      private Vector3[] targetPoints = {
          new Vector3(-15,0,15),
          new Vector3(15,0,15),
          new Vector3(15,0,-15),
          new Vector3(-15,0,-15)};
  
      private float movementSpeed = 10;
  
      GameObject bombPrefab;
  
      Transform player;
  
      private void Start()
      {
          bombPrefab = Resources.Load(StringCollection.BOMB) as GameObject;
          player = Globals.GetPlayerObject().transform;
      }
  
      private void Update()
      {
          transform.LookAt(player); // set the object rotation
  
          Vector3 nextPoint = targetPoints[nextPointIndex]; // get the target point
          transform.position = Vector3.MoveTowards(transform.position, nextPoint, movementSpeed * Time.deltaTime); // move the spawner
          if (transform.position == nextPoint) // point reached? set a new point 
          {
              if (nextPointIndex &lt; targetPoints.Length - 1)
                  nextPointIndex++;
              else
                  nextPointIndex = 0;
          }
      }
  }
  </code></pre>
  
  <p>So I could write a method like this</p>
  
  <pre><code>void SpawnBomb()
  {
  GameObject spawnedBomb = Instantiate(bombPrefab);
  }
  </code></pre>
  
  <p>but how do I achieve the throwing mechanic? For a first try, the targetPoint is <code>player.position</code> that should be fine.</p>