so far - so clear, many thanks. another item: when im driving through this tunnel, i want to be able to move the camera to the right or left, depending on a variable which changes all the time (Which i get from the kinect, but programmatically i have a variable with an amount starting from 0 - width (0 - 1024 as example).
and asking myself if its what i need. I want to manipulate an existing, interpolated path during I am on the camera drive. Im very sorry about my basic questions - but im not a programmer and without some tutorials im sometimes a bit helpless.
- import hardcorepawn.fog.*;
- import processing.video.*;
- import processing.opengl.*;
- PImage img;
- PImage imgTitle;
- PImage imgSubtitle;
- float radius = 100;
- float kreise = 260;
- int imgwidth = 10;
- PFont helvetica;
- int camPosNumb = 30;
- float[] camPosX = new float[camPosNumb];
- float[] camPosY= new float[camPosNumb];
- float[] camPosZ= new float[camPosNumb];
- int camPosIndex = 0;
- import peasy.*;
- import remixlab.proscene.*;
- Scene scene;
- KeyFrameInterpolator kfi;
- fog myFog;
- float nearDist = 40;
- float farDist = 70;
- color fogColor = color(0);
- void setup() {
- size(506, 900, OPENGL);
- myFog=new fog(this);
- myFog.setupFog(nearDist,farDist);
- myFog.setColor(fogColor);
- img = loadImage("samuellebowitz_weisserfont-01.png");
- imgTitle = loadImage("samuellebowitz_schwarzerfont-05.png");
- imgSubtitle = loadImage("samuellebowitz_schwarzerfont-05.png");
- scene = new Scene(this);
- helvetica = loadFont("HelveticaNeue-Light-48.vlw");
- //füllen array mit kamera-Positions-Daten
- for (int i = 0; i < camPosX.length; i+=1) {
- camPosY[i] = cos(radians(i*(360/camPosNumb)))*(radius+imgwidth*0.7); //
- camPosX[i] = imgwidth/2;
- camPosZ[i] = sin(radians(i*(360/camPosNumb)))*(radius+imgwidth/2);
- }
-
- for (int i = 0; i < camPosNumb-1; i++) {
- scene.camera().setPosition(new PVector(camPosX[camPosIndex],
- camPosY[camPosIndex],
- camPosZ[camPosIndex]));
-
- scene.camera().setOrientation(1,1);
- scene.camera().lookAt(new PVector(camPosX[camPosIndex+1],
- camPosY[camPosIndex+1],
- camPosZ[camPosIndex+1]));
-
- scene.camera().addKeyFrameToPath(1);
- //re-position the camera:
- camPosIndex +=1;
- }
- scene.camera().setPosition(new PVector(sin(radians(10))*radius,cos(radians(10))*radius,1));
- scene.camera().lookAt(new PVector(sin(radians(15))*radius,cos(radians(15))*radius,1));
-
- scene.showAll();
- kfi = scene.camera().keyFrameInterpolator(scene.path('1'));
- kfi.setInterpolationSpeed(0.02);
- //scene.setCameraPathsAreDrawn(true);
- }
- void draw() {
- println("lastFrameUpdate" +scene.camera().lastFrameUpdate);
- background(0);
- if (camPosIndex >= camPosNumb-1) {
- camPosIndex=0;
-
- }
- for (int i = 0; i < 360; i+=360/kreise) {
- float z = sin(radians(i))*radius;
- float y = cos(radians(i))*radius;
- pushMatrix();
- translate(0,y,-z);
- rotateX(radians(-i));
- fill(0, 255, 255);
- //text für grad-anzeigen
- //rotateY(radians(180));
- //textFont(helvetica, 1);
- //text(360-i+"°", -10, -10);
- //rotateY(radians(180));
- //text-ringe
- image(img, 0, 0, imgwidth, imgwidth);
- popMatrix();
- }
-
- }
- void keyPressed() {
- kfi = scene.camera().keyFrameInterpolator(scene.path('1'));
- if (kfi == null)
- return;
- if( key == 'u' || key == 'v' ) {
- if ( key == 'u')
- kfi.setInterpolationSpeed(kfi.interpolationSpeed()-0.01);
- if ( key == 'v')
- kfi.setInterpolationSpeed(kfi.interpolationSpeed()+0.01);
- println("interpolation speed = " + kfi.interpolationSpeed());
- }
-
- if (key == 'i') {
- save("printscreen.png");
- }
- }