I was adding random size and rotation for astreroids in my game Space Frontier and thought i share the script i made maybe someone will find it useful
I needed random rotation also so they all would rotate in diffrent directions
if you use it you must put it before you clone the original node and change steriod1 in the script to your original node name
st = ccbGetSceneNodeFromName("steroid1");
x = Math.floor((Math.random() * 360) + 1); y = Math.floor((Math.random() * 360) + 1); z = Math.floor((Math.random() * 360) + 1);
scale = Math.floor((Math.random() * 30) + 5);
ccbSetSceneNodeProperty(st, "Rotation", x, y, z); ccbSetSceneNodeProperty(st, "Scale", scale, scale, scale);
|