To set randomly the clips in the texture maps you can use a random function to change the index of the clip.
A quick test (you will need to change the image source name) :
var cGrids = ActiveSceneRoot.FindChildren("grid*");
oEnum = new Enumerator( cGrids ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
var oGrid = oEnum.item() ;
var rdm = Math.random();
var index = randomClipIndex(rdm);
SetValue(oGrid+".Texture_Map.ImageClipName", "Clips.seq__0__9_1__tga"+index , null);
}
function randomClipIndex(rdm)
{
var index = 1 ;
if(rdm < 0.1){
return index ;
}
if(rdm < 0.2){
index = 2;
return index ;
}
if(rdm < 0.4){
index = 3;
return index ;
}
if(rdm < 0.6){
index = 4;
return index ;
}
if(rdm < 0.8){
index = 5;
return index ;
}
if(rdm > 0.8){
index = 6;
return index ;
}
}
I'm sure there is a better way to do the random function but it gives the idea.
1/2
--
Guillaume Laforge | La Maison
On Fri, 04 May 2007 09:29:28 +0200, Andy Jones <andy(at)thefront.com> wrote:
> Hey,
>
> I'm trying to do a simple test with a crowd of "card" people. I.e., I
> want to be able to create a whole bunch of 2D grids in my scene that
> orient straight up, but with an up-vector to the camera, and have
> randomized offsets in the sequence of images serving as the texture.
> That way, it won't be as noticeable when the same person is used
> multiple times, as their motion won't sync up.
>
> I've managed to make a particle cloud with PEvent scripts that deal with
> the orientation properly. But now I'm finding it difficult to sketch
> particles to place them where I want them and have them still be
> effected by the script. Only the simulated particles seem to have the
> event applied. Is there a way around this?
>
> If not, is there a way to do a randomized retiming of the texture
> sequence within a shader without having to create a bajillion different
> materials? If so, I could do this with standard 3D objects...
>
> - Andy
>
>
> -
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi