用滑鼠畫線
import de.voidplus.leapmotion.*;
LeapMotion leap;
float []X=new int[1000];
float []Y=new int[1000];
float []Z=new int[1000];
int now=0;
int angle=0;
void setup(){
size(800,800,P3D);
leap= new LeapMotion(this);
}
void draw(){
for(Hand hand: leap.getHands()){
PVector pos=hand.getPosition();
X[now]=pos.x;
Y[now]=pos.y;
Z[now]=pos.z;
now++;
}
background(255);
if(key=' ' && keyPressed) angle+=0.01;
translate(400,400);
rotateY(angle);
translate(-400,-400);
for(int i=1;i<now;i++){
line(X[i],Y[i],X[i-1],Y[i-1]);
}
}
期中作品:貓狗大作戰
風向
血量
控制丟的力道
沒有留言:
張貼留言