邱詠縉、劉冠逸 同一組
劃出模擬直升機
畫出跟著手旋轉的地板
可以隨著手的高度旋轉上下移動,模擬出上下飛的感覺
import de.voidplus.leapmotion.*;
LeapMotion leap;
void setup() {
size(800, 500, P3D);
leap = new LeapMotion(this);
}
float nowX=0,nowY=0,nowA=0,nowZ=0;
void draw() {
nowY+=10*cos(nowA); nowX+=10*sin(nowA);nowZ+=5*tan(nowA);
background(255);
for(int i=-10;i<=10;i++){
for(int j=-10;j<=10;j++){
pushMatrix();
translate(300,300);
rotateX(radians(70));
rotateZ(nowA);
translate(i*200+nowX,j*200+nowY,nowZ);
fill(255);box(200);
popMatrix();
}
}
for (Hand hand : leap.getHands ())
{
hand.draw();
float angle = hand.getYaw();
PVector pos = hand.getPosition();
nowA += radians(-angle/40);
translate(pos.x, pos.y, pos.z);
rotateY(-radians(angle));
fill(128);stroke(0);box(100);
}
}
沒有留言:
張貼留言