主题:  翻译一篇,

hw3d

职务:普通成员
等级:1
金币:0.0
发贴:27
注册:2002/6/14 17:24:44
#12002/6/14 22:30:18
这是一个很经典的例子,,在火星人的新书<>中也有这人例子,可以参照看一下.
1.首先我们来建立文字,在creat/text /输入26个英文字母,当然也可以是其它的,在text中选择ploy.
2.我们为这26个字母命名,我们用下面简单的mel语言来实现.
int $i;
string $t="abcdefghijklmnopqrstuvwxyz";
string $cmd="rename Trim_Char_";
for($i=1;$i<=26;$i++)
{string $temp;
$temp=eval("substring "+$t+" "+$i+" "+$i);
print($temp);
eval($cmd+$temp+"_1_1 "+"text"+$i);
};
将以上代码输入script editor中,然后按数字键上的enter键,执行该代码,我们可以看到在outline中,我们的26个英文字母将被命名为text1,text1......
2.为了使这26个字母动起来,我们需要使用particleinstancer,这是控制多个相同物体的运动的快捷方式,我们可以用它来控制如多个鸟翅膀的
不规则的运动等,非常方便,只需设定几个状态就可以搞定,这方面的详细部分请参看help.
好了,我们还是来看这个例子。
为了使字母能与particleinstancer,联系起来,我们先来:
(1)建立一个平面,设置10*20,给它加一个 particle emitter
类型设为 suface,让它作用均匀。设置speed 为15.也可以自己设定,emitter rate为10,这个值越大,这26个字母的位置变化越快。
(2)增加一个属性给particle note,选择particleshape1,打开attribute editor ,点general, 增加一个attribute 名为index,attribute为Array.
(3)这一步是比较关键的一步,建立particleinstancer,选择polygen letters ,注意不要用组来选择,创建particle instancer,打开'allow all data types',在objectindex中选择index.完成设置后,单击creat.
(4)为了出现字母杂乱无章的状态,我们在给particleshape1增加一个gate属性,在particleshape1增加一个runtime expressions:
particleShape1.index=rand(1,26);
vector $temp=particleShape1.worldVelocity;
if ($temp.y<=rand(-10,-5))
{ particleShape1.gate=1;};
if ($temp.y>=(-1))
{particleShape1.gate=0;};

if (particleShape1.gate==1){ particleShape1.acceleration=<<0,rand(20,25),0>>;
//print("aaaa");
};
if (particleShape1.gate==0) {
particleShape1.acceleration=<<0,rand(-25,-20),0>>;
//print("bbbb");
};

在这个expression中我们主要用到了rand这个函数,

(5)选择26字母将它隐藏,现在播放一下,效果就出来了,
最后我们选用合成软件做出拖尾的效果,





5D荣誉斑竹

职务:普通成员
等级:5
金币:10.0
发贴:1326
注册:2002/2/13 13:21:48
#22002/6/30 0:05:39