# \[queasycam\] controlling functions with CP5

**URL:** https://discourse.processing.org/t/queasycam-controlling-functions-with-cp5/9944
**Category:** Libraries
**Created:** [April 4, 2019, 12:26am UTC](https://discourse.processing.org/t/queasycam-controlling-functions-with-cp5/9944 "2019-04-04T00:26:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![eduzal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/eduzal/32/759_2.png) [@eduzal](https://discourse.processing.org/u/eduzal)
#### Post date: [April 4, 2019, 12:26am UTC](https://discourse.processing.org/t/queasycam-controlling-functions-with-cp5/9944/1 "2019-04-04T00:26:36Z")

</div>

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

```auto
cam.position();

```

it returns

```auto
The function "position()" does not exist

```

same goes for pan or tilt

tks

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [April 4, 2019, 1:56am UTC](https://discourse.processing.org/t/queasycam-controlling-functions-with-cp5/9944/2 "2019-04-04T01:56:28Z")

</div>

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

```auto
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 !

---

<div class="post-metadata">

### Author: ![eduzal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/eduzal/32/759_2.png) [@eduzal](https://discourse.processing.org/u/eduzal)
#### Post date: [April 4, 2019, 4:51am UTC](https://discourse.processing.org/t/queasycam-controlling-functions-with-cp5/9944/3 "2019-04-04T04:51:06Z")

</div>

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

tks

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [April 6, 2019, 2:23am UTC](https://discourse.processing.org/t/queasycam-controlling-functions-with-cp5/9944/4 "2019-04-06T02:23:39Z")

</div>

> [@eduzal](#):
>
> cam.position()

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.](https://github.com/jrc03c/queasycam)

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

- [https://processing.org/reference/PVector.html](https://processing.org/reference/PVector.html)

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