(2)T-R-T及關節運動
(3)存檔、讀檔、播放
(4)內插動作Interpolate
(5)期末作品
先從T-R-T範例
TRT.exe
TRT.cpp
根據上星期的專案到這裡,

void motion(int x, int y)
{ angle[angleID] -= y - oldY;
oldY=y; oldX=x;
if(fout==NULL)fout=fopen("a.txt","w+");
for(int i=0;i<10;i++)
{
printf("%f ",angle[i]);
fprintf(fout, "%f " , angle[i]);//空格要有,不然不會play
}
printf("\n");
fprintf(fout,"\n");
}
void readNew()
{
if(fin==NULL)fin=fopen("a.txt","r");
for(int i=0;i<10;i++)
{
angleOld[i]=angleNew[i];///睏到竟然少打這行都沒發現,結果play完一直重跑最後一秒
fscanf(fin,"%f ", &angleNew[i]);
printf("%f ",angleNew[i]);
}
printf("\n");
}
沒有留言:
張貼留言