- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
Reder13 · Jan 16, 2015 at 08:38 PM ·
rotationgameobjectprefabquaternioninstatiate
Troubles instatiating a gameobject with rotation
Hi, so here's my problem: I have this code that I've used to make a shotgun fire a scatter shot, kinda like buckshot. The problem that I'm having is that its creating 8 shots but the rotation of them isnt getting altered at all.
They all have the same rotation as my character has, which he gets from a joystick. All i want to do is be able to instantiate some prefabs that have slightly altered rotation about the y axis. Any ideas for me?
for ( var j : int = 0; j < 8; j++){
var rand : int;
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);
}
Comment