Hello, I am a new user of processing, and i just got the Leap motion sensor. I am working on a project, and my idea is to use the ARToolKit and the sensor to interact with a 3D form. I have been looking for a code that allows me to do that, but I haven't been able to find one. I was wondering if someone has a sample that can share with me so i can play with it. Any help on how to write or provide me the part that lets me interact with the 3D form will be gladly appreciated. The initial code that i have is the following:
import de.voidplus.leapmotion.*;
import development.*;
import processing.video.*;
import jp.nyatla.nyar4psg.*;
Capture cam;
MultiMarker nya;
int markerSize = 60;
PVector offset = new PVector(0,50,0);
void setup() {
size(640,480,P3D);
colorMode(RGB, 100);
//VIDEO
cam = new Capture(this,640,480);
cam.start();
//NYAR
nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG);
nya.addARMarker("patt.hiro",markerSize);//id=0
}
void draw() {
if (cam.available() !=true) {
return;
}
cam.read();
PMatrix3D p = new PMatrix3D();
nya.detect(cam);
background(cam);
if((!nya.isExistMarker(0))){
return;
}
textAlign(LEFT, TOP);
textSize(10);
noStroke();
nya.setARPerspective();
pushMatrix();
setMatrix(nya.getMarkerMatrix(0));
scale(1, -1); // turn things upside down to work intuitively for Processing users
translate(0, 0, 20); // translate the box by half (20) of it's size (40)
stroke(0); // give the box a black stroke
box(40); // the BOX! ;-)
noLights(); // turn off the lights
// translate(0, 0, 20.1); // translate to just slightly above the box (to prevent OPENGL uglyness)
noStroke();
fill(255,0,0);
rect(-20, -20, 40, 40); // display a transparent white rectangle right above the box
translate(0, 0, 20.1); // translate to just slightly above the rectangle (to prevent OPENGL uglyness)
fill(255,0,0);
popMatrix();
beginCamera();
camera(width/2 , height/2 , (height/2) / tan(PI/6), width/2, height/2, 0, 0, 1, 0);
translate(offset.x,offset.y,offset.z);
endCamera();
}
Thank you very much for your help,
Carlos