ScriptSpot

Forum topic · General Scripting

Material Animation Problem

By RapBoyX · 2009-09-09

Downloads
Description

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...

Comments (3)

Anubis · 2009-09-09

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.

Anubis · 2009-09-09

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

RapBoyX · 2009-09-09

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.