[newbie - 1 day of experience]
I have 9 cubes on screen (grid 3x3).
I want to keep rotating them in different directions at different speeds.
I made a single script and assigned it to all 9 cubes.
But all the cubes spin in the same direction? My guess is the problem might be single evaluation of the script??
You are on the right track but forgot a couple of things. Your algorithm will actually vary the rotation as each cube will show discrepancy in rotation over time. The problem is that they will always move in the positive direction along the x,y,z axes because Random.value is a value generated between 0.0 - 1.0
This is how you get both positive and negative rotations, as well as greater randomness in axes:
Simply set the x,y,z in the Update() loop if you want a jittery effect instead.
You can also simply do this:
But I doubt you'll want to change that every frame as it'll be hyper. It is good to use in the Start() function to set an initial random object rotation.
answered Mar 03, 2010 at 12:16 PM