2015年3月9日 星期一

week03

import de.voidplus.leapmotion.*;
LeapMotion leap;

void setup() {
  size(600, 600, P3D);
  leap = new LeapMotion(this);
}
void draw(){
  background(255);
  for(Hand hand : leap.getHands()){
    println("yaw:"+hand.getYaw());
    pushMatrix();
    translate(300,300);
    rotateY(hand.getYaw()*0.1);
    box(100);
    popMatrix();
   
   
    hand.draw();
    myDraw(hand.getPosition());
    myDraw(hand.getThumb().getPosition());
    myDraw(hand.getIndexFinger().getPosition());
    myDraw(hand.getMiddleFinger().getPosition());
    myDraw(hand.getRingFinger().getPosition());
    myDraw(hand.getPinkyFinger().getPosition());
   
  }
}
void myDraw(PVector pos){
    pushMatrix();
    translate(pos.x, pos.y);
    fill(255,0,0); sphere(20);
    popMatrix();  

}





因為29號無法使用 Leap Motion 所以只有程式碼,之後會補上。

沒有留言:

張貼留言