Code! ![]()
#pragma strict
#pragma downcast
var arrow : Transform;
var pos = new Array();
var rotation = new Array();
function Start()
{
pos = [-0.9, -0.3, 0.3, 0.9];
rotation = [1, 180, 0, -1];
var direction;
for(var i = 0; i <= 16; i++)
{
direction = Random.Range(0, 4);
var clone = Instantiate(arrow, Vector3(pos[direction], -2.4, 0), transform.rotation);
clone.transform.rotation.z = rotation[direction];
yield WaitForSeconds(1);
}
}
So basically, whenever I run this code, when I do Instantiate(), my arrow instantiates, but it is usually off a little bit. The thing is, it only does this when I try to change it to -0.3 and 0.3, and it can offset between -0.3 and -0.4. Hm???
Quick commment: Does rigidbody position count for anything?
– static_castI figured out that my arrows were bouncing off items offscreen. I cannot fix this until the release the 2D version of IgnoreCollision apparently. Gonna go work out another fix.
– static_cast