(AE表達式求解) 將"A"的角度 跟隨"B"位置

如題
將"A"的角度 跟隨"B"
我想這個可以應用在很多地方
如:眼球盯著某物件、剪頭全部指向同一個方位

所以想請知道的大大求解 感恩

箭頭方向要追蹤,其實只要Parent眼睛的rotation就好
表達式應該用在眼球,但我不會寫眼球視線的表達式
所以我上網抓了一個免費的眼球,再加上一張臉
下載下來裡面有寫表達式,你再自行研究。
這影片裡唯一位置有設Keyframe的就是"看我"這兩個字,眼球跟箭頭是全自動追蹤


他的眼球的Anchor Point是這樣寫的
try{
select = effect("OC EYES")("Look At");
deadzone = linear(effect("OC EYES")("Look Sensitivity"),0,100,100,0);

loutline = content("L EYE").content("main eye").content("main outline").content("outline").size;
psize = content("L EYE").content("IRIS MAIN").content("pupil").content("IRIS").content("IRIS").size

outer = (loutline[0]/2)-(psize[0]/2);

pupilpos = thisLayer.toWorld(anchorPoint);
selectpos = select.toWorld(anchorPoint);
dist = (length(pupilpos, selectpos))/deadzone;

if(dist>=outer)
val = [0,outer];
else
val = [0,dist];

(val/100)*effect("OC EYES")("Iris Distance")

}catch(err){
[0,1]
}


他的眼球的rotation是這樣寫的
rot = effect("OC EYES")("Iris Rotation");

L = thisLayer;
thisRot = L.rotation;

while(L.hasParent){
thisRot += L.parent.rotation;
L = L.parent;
}

try{
select =effect("OC EYES")("Look At");

pointA = thisLayer.toWorld(anchorPoint);
pointB = select.toWorld(anchorPoint);

a = pointA[0] - pointB[0];
b = pointA[1] - pointB[1];
switcher = 0;

if (b < 0) {switcher = -180};
if (b == 0) {degree = 90} else {degree = -radiansToDegrees(Math.atan(a/b))}



degree + value + switcher + rot - thisRot

}catch(err){
value + rot - thisRot
}


如果有錢,有個插件叫joystick,能輕易做到眼球的控制
文章分享
評分
評分
複製連結

今日熱門文章 網友點擊推薦!