Question by 
               Vento313 · Jul 07, 2017 at 08:14 PM · 
                instantiatetransformpositioninstantiationinstantiating  
              
 
              Gameobjects instantiating in the wrong position
I'm trying to instantiate a gameobject five times in a horizontal line in front of the player (sort of like a shotgun, but the bullets are on a horizontal line).
This is what I wrote so far:
 GameObject tempObj;
 tempObj = Instantiate (groundBulletPrefab) as GameObject;
 AoEPosition = new Vector3 (transform.position.x - 2.0f + (i*1),transform.position.y,transform.position.z);
 tempObj.transform.position = AoEPosition + cameraTransform.forward;
 Rigidbody projectile = tempObj.GetComponent<Rigidbody>();
 projectile.velocity = cameraTransform.forward * shootSpeed;
It works well when the player is in the starting position, but when I turn 90 degrees to the left or right the bullets get spawned in a straight line in front of the player and perpendicular to it.
I think the problem is in the AoEPosition Vector3, since I only change the x axis coordinates, but I don't know how to fix it.
Got any tips?
Thanks!
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                