[queasycam] controlling functions with CP5

Hi,

I wanna know if there’s a way to numerically control queasycam features, like position, pan and tilt.
what i really need is to have a virtual camera on a 3D environment, controlled by cp5 sliders instead of the mouse.
it gets troublesome since when I use

cam.position();

it returns

The function "position()" does not exist

same goes for pan or tilt

tks

1 Like

just play first time QUEASY
and found that position vector works here
( win 7 / 64bit // processing 3.5.3 / java mode // QueasyCam 1.5 )

also i have a other idea for operation,
i used instead CP5

mouseWheel Plus Plus

and added rotation too

import queasycam.*;
QueasyCam cam;

float angx=0, angy, dang=TWO_PI/360;
String info = "QUEASY CAM\nand mouse Wheel plusplus\nuse press key [x][y][z] position, [v][h] rotation\nand turn mouseWheel";

void setup() {
  size(400, 400, P3D);
  cam = new QueasyCam(this);
  cam.sensitivity = 1;
  cam.speed = 0.1;
  cam.position.x = 0;
  cam.position.y = 0;
  cam.position.z = 30;
  perspective(PI/3, (float)width/height, 0.2, 10000);
  println(info);  
}

void draw() {
  background(51);
  rotateX(angx);
  rotateY(angy);
  box(10);
}

void mouseWheel(MouseEvent event) {
  float e = event.getCount();
  if ( keyPressed && key == 'x' ) cam.position.x += e;                     // [x] 
  if ( keyPressed && key == 'y' ) cam.position.y += e;                     // [y] 
  if ( keyPressed && key == 'z' ) cam.position.z += e;                     // [z] 
  if ( keyPressed && key == 'v' ) angx += e*dang;                          // [v]  
  if ( keyPressed && key == 'h' ) angy += e*dang;                          // [h]  
}


the idea is you can multiplex the mouse wheel by pressing keys,
so 5 sliders with 5 lines of code ? has something !

1 Like

looks awesome. will try it. a very nice beginning.

tks

To expand on @kll 's answer: the reason that code didn’t work and this does is it is an object, not a method.

From the QueasyCam library:

position = a 3D PVector that represents the position of the camera
GitHub - jrc03c/queasycam: (!!! NOTE: INACTIVE PROJECT !!!) A super-simple FPS camera library for Processing.

So position isn’t a method – it is a PVector object

…which means you can use position.x – or position.set(x, y, z) – plus .rotate(), .mult(), .lerp(), et cetera.

2 Likes