包含11節(jié)視頻教程
關(guān)注13.1萬次
Maya動(dòng)力學(xué)就是指:用粒子模擬出現(xiàn)實(shí)中的煙霧、塵土、云彩、火焰、流水等效果。 廣泛在電影等特效。
首先建兩個(gè)圖層,畫一個(gè)炮和一個(gè)炮彈,做成movieclip給炮起名叫spaceship,圖庫的炮彈上右擊,選linkage,選第一項(xiàng),并起名叫projectile。
把炮彈托到舞臺(tái)外面,一定要托出來,要不就不好用(因?yàn)槟阍趌inkage時(shí)沒有選第三項(xiàng))。
下面是主要的:再建一個(gè)圖層,在這兩個(gè)圖層的上面。
speed = 4; // 是炮彈移動(dòng)的速度
depth = 0; // 復(fù)制的炮彈深度
nose = 50; // (這個(gè)值跟你的炮的寬度而定)
_root.onmousemove = function() {
updateafterevent();
xdiff = _root._xmouse-spaceship._x;
ydiff = _root._ymouse-spaceship._y;
angle = math.atan2(ydiff, xdiff);
angle = angle*180/math.pi;
spaceship._rotation = angle;
};
//上面主要是取角度
_root.onmousedown = function() {
angle = spaceship._rotation;
angle = angle*math.pi/180;
++depth;
name = "projectile"+depth;
_root.attachmovie("projectile", name, depth);//復(fù)制炮彈
_root[name]._x = spaceship._x+nose*math.cos(angle);
_root[name]._y = spaceship._y+nose*math.sin(angle);// 炮彈發(fā)出的位置
_root[name].xmov = speed*math.cos(angle);
_root[name].ymov = speed*math.sin(angle); // 炮彈發(fā)出的角度
_root[name].onenterframe = function() {
this._x += this.xmov;
this._y += this.ymov;
};//炮彈移動(dòng)
};
shoot.fla (44.0k)
完
朱峰社區(qū)網(wǎng)頁版(手機(jī)掃描-分享-添加到屏幕)
朱峰社區(qū)微信公眾號(hào)(微信掃一掃-關(guān)注)
未知用戶
2005-2025 朱峰社區(qū) 版權(quán)所有 遼ICP備2021001865號(hào)-1
2005-2025 ZhuFeng Community All Rights Reserved
VIP