Material Animation Problem

I have this weird problem: I'm trying to animate 16 cylinders (material animation). I wrote this code:

mm = multimaterial numsubs:13;
mm.name = "Light Anim"
meditMaterials[1] = mm;

mm[1]=meditMaterials[7];
-- I declared up to the 13th Material.
mm[13]=meditMaterials[23];

colors = #(4,5,6,7,8,9,10,11,12,13,4,5,6,7,8,9);

-- After creating and chaning positions of the cylinders
-- and giving them their initial materials

for m=1 to 16 do
(
animate on at time (m*50)
cylinders[m].modifiers[#MaterialMod].materialID = 2;
)

After this code I find that the cylinders change colors by a weird way - like the colors are swapped somehow.

Is this the right way for animating the elements ?
I tried to use some lock keys but I didn't help...

AttachmentSize
testing_2.ms2.35 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

When where is the

When where is the problem?... You has 13 sub materials and can use any of them at any given frames. In your script you set all to 2:
cylinders[m].modifiers[#MaterialMod].materialID = 2
Also I see you defined array "colors" but you dont used it.
May this help.

my recent MAXScripts RSS (archive here)

Anubis's picture

MaterialModifier realy swaps

MaterialModifier realy swaps and if you want another effect, just define it to can someone help you.

my recent MAXScripts RSS (archive here)

RapBoyX's picture

what should I use, so it

what should I use, so it won't swap ?

I need to choose a specific material for the object at given frames - and not the swapping effect.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.