Hi there,
My index always seems to be going out of range and I am unsure why.
I am setting a tweened path for an array of transforms (coins),
I first gather the first 3, the second 3 and so on members of another array (nodes) until nodes limit is hit (a number divisible by 3),
and then I am creating the tween.
The error occurs at line 7 of the second for loop. The index is out of range, after the first run thru. It makes no sense to me as to why.
Thanks
// Update is called once per frame
void jpCoinsWonPlayExplosion () {
///create and play the coins tweens/
print("coins won explosion " + Time.time);
coinTweens = new Tweener[coins.Length];
coinsLength = coins.Length;
nodesPos = new Vector3[3];
for(int i = 0; i < coinsLength; i++){
///pass transfrom[] to a transform. needed?
///gather the nodes for the path.
for(int n = 0; n < 3; n++){
int nodeMember = (i * 3) + n;///here is where it gets tricky. if i >0, I am already retaking taken nodes.not good.
print("nodeMember " + nodeMember);
node = nodes[nodeMember];///How do I insure the nodeMember, is always
nodesPos[nodeMember] = node.localPosition; //////!!!!!!!!!STILL GETTING ERROR HEAR. Index Out Of Range.
}
print("nodesPos length = " + nodesPos.Length);
coins[i].gameObject.renderer.enabled = true;
print("coins[i] " + coins[i]);
// Setup the tween brain using the given path
coinTweens[i] = HOTween.To(coins[i], tweenTime, new TweenParms()
.Prop("position", new PlugVector3Path(nodesPos, PathType.Curved)) // Set the PlugVector3Path plugin
.Ease(EaseType.EaseInExpo) // Set a linear easing
.AutoKill(false) // Prevent the tween to be auto-killed when it completes
.Pause(true) // Set the tween in a paused state
.Loops(7)
);
coinTweens[i].Restart();
if(i == 3)
return;
print("coinsTween[i] created i = " + i);
}
}