- Home /
 
 
               Question by 
               penguinsrepic · Apr 08, 2020 at 06:16 PM · 
                2dinstantiateshooting  
              
 
              How do I instantiate in front of my character?
I want to have arrows spawn in front of my character instead of appearing inside of him. I've looked at some solutions that worked for other people but I couldn't find anything that works for me.
     void Shoot()
     {
         animator.SetBool("Attacking", true);
         for (int i = 0; i < arrowsShot; i++)
         {
             GameObject bullet = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
             Rigidbody2D rb = bullet.GetComponent<Rigidbody2D>();
             rb.AddForce(firePoint.up * bulletForce, ForceMode2D.Impulse);
         }
     }
 
              
               Comment
              
 
               
              You shloud spend next hours learning basic Unity...
You need to set a position in front of the character. Use transform.forward for example..
Your answer