I am trying to Instantiate a prefab onto the scene setting the rotation by the transforms rotation. Here is a snippet of code where I am stuck on:
var angle : float = -15.0; // or if I set this to 0.0 (read more to understand)
for ( var i : int = 0; i < 3; i++ )
{
transform.RotateAround(transform.position, Vector3.up, angle);
Instantiate(theTransformToAdd, transform.position, transform.rotation);
Debug.Log(angle);
angle += 15.0;
}
I am trying to make a gun shoot bullets like a ‘burst’ effect.
If I set the angle variable to -15.0 and run the editor, and shoot the gun to make the bullets appear, then pause the editor, 2 of the 3 bullets have a rotation of 345.0 while the other has a rotation of 0.0.
If I set the angle variable to 0.0, run and pause the editor when the bullets appear, the first 2 bullets have the correct rotation of 0.0 and 15.0. But the third bullet has a rotation of 45.0?
WHAT I am doing wrong here? Thanks in advance!