动画表达式算法的问题(物理或数学高手请进)
这是一段MAYA中的动画表达式,如果您不会MAYA也没关系,相信只要你有程序基础和一定的物理或数学知识,就能回答如下问题.
谁能告诉我这段表达式算法的含义,,(注:我表达式语法没有问题,只解释算法就可以了,只给链接不给解释的混分族勿扰!)
//keepseatbalanced
$seatHeight=unicycle:wheel.translateY+0;
$seatX=unicycle:uniCycle.translateZ;
$wheelX=unicycle:wheel.translateZ;
$dist=abs(unicycle:wheel.translateZ-unicycle:uniCycle.translateZ);
if($dist=0)
unicycle:uniCycle.translateY=$seatHeight-$dist/3;
else
unicycle:uniCycle.translateY=$seatHeight;
//Rotationstuff
//globalvector$twistold;
vector$twistpos=;
vector$spaz=$twistpos-;
unicycle:wheel.twistoldX=$twistpos.x;
unicycle:wheel.twistoldY=$twistpos.y;
unicycle:wheel.twistoldZ=$twistpos.z;
//float$rad=wheel.scaleX;
float$rad=.035;
if($spaz.z0)
{
unicycle:wheel.rotateX=unicycle:wheel.rotateX+mag($spaz)/$rad;
}
float$dt=1.0/24.0;
float$d;
float$w=0.0;
$w=$w*$w*$w;
float$a=0.0;
if(frame==1)
{
unicycle:wheel.translateZ=(unicycle:uniCycle.translateZ+unicycle:wheel.translateZTouniCycle_translateZOffset);
}
$d=unicycle:uniCycle.translateZ+unicycle:wheel.translateZTouniCycle_translateZOffset-unicycle:wheel.translateZ;
$w=unicycle:wheel.translateZTouniCycle_translateZWeight;$w=$w*$w*$w;
$a=$w*(($d/$dt)-unicycle:wheel.translateZ_Velocity)/$dt;
unicycle:wheel.translateZ_Velocity=unicycle:wheel.translateZ_Velocity+$a*$dt;
unicycle:wheel.translateZ=unicycle:wheel.translateZ+unicycle:wheel.translateZ_Velocity*$dt;
简要说明一下,unicycle:uniCycle是一个独轮自行车的坐架,unicycle:wheel是它的轮子.