I’ve been working on a rhythm game in unity 2d, and I found something odd: Rotating an objects z-axis to the value of 1 makes it 90 degrees, -1 to -90 degrees, and anything else to 180 degrees. Hm?
#pragma strict
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];
Debug.Log(rotation[direction]);
yield WaitForSeconds(1);
}
}
Hey thanks man! That really helps. +1
– static_cast