- Home /
 
               Question by 
               Reder13 · Jan 16, 2015 at 09:28 PM · 
                rotationgameobjectinstantiatequaternionscale  
              
 
              Having trouble instantiating a gameobject with rotation
ok so im trying to create a buckshot for a shotgun and it worked fine until i imported the settings to andriod and added a joystick.
now its creating 8 shots but all with the same rotation as the character or joystick and not a scatter shot at all. is there any way to manipulate this to create a projectile with a random angle? thanks!
for ( var j : int = 0; j < 8; j++){
     var rand : int = 90;
     
     
     if ( PlayerPrefs.GetInt("Attachment") == 5){
     rand = Random.Range (-50,50);
     }
     else if (PlayerPrefs.GetInt("Attachment") == 7){
     rand = Random.Range (-15,15);
     }
     else {
     rand = Random.Range (-30, 30);
     }
 
     projectile = GameObject.Instantiate(projectilePrefab, startPosition,
                      Quaternion.Euler(0,rand,0));
 
     projectile.tag = "Gun";
     
     
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                