rotate the camera (roll) in QueasyCam?

edited July 2017 in Library Questions

So I've tried the default camera, OCD, PeasyCam, and even tried Proscene, but QueasyCam gives me the best results for my program. However, it does not have the built in ability to rotate (roll) the camera and I'm not sure how to go about giving it that feature.

Does anybody have any ideas?

https://github.com/jrc03c/queasycam

Thank you!

(my appologies to the mods for not putting this Q on the correct board to begin with)

Tagged:

Answers

  • Look at examplesfor queasy

    Write a mail to the author of the lib

  • However, it does not have the built in ability to rotate (roll) the camera

    from that link:

    tilt = a float value that represents the rotation of the camera around the horizontal axis

    is that not the same thing?

  • So I tried it and this is what I got:

    Pan rotates the camera view left or right. If you want to cross a street, you want to use pan.

    Tilt rotates the camera up and down. If you want to see your feet, you use tilt.

    Then I tried a combination of tilt and pan in order to fool the system and to change the axis of rotation. For example. Tilt +90 follow by pan +45 follow by tilt -90. QueasyCam applies all those actions independently to each other. So, nop, you cannot get roll based on the provided documentation. Maybe there are extra functions in the library not documented? You can approach the owner of the repo and ask him, as @Chrisir has suggested or generate a new code. You could explore previous posts and I am sure somebody has tried this before. They are easy to find sometimes...

    Check these posts for example:

    https://forum.processing.org/two/discussion/comment/27272/#Comment_27272

    https://forum.processing.org/two/discussion/20235/align-box-with-vector

    Kf

  • Ah ok, so tilt is pitch and pan is yaw but there is no roll. Maybe that's by design, given the first person view.

    The code is all there at github but i don't profess to understand it.

  • And if you rotate the entire scene to get roll?

  • A simple test shows it is possible by calling rotateZ(). However I don't think it will work without integrating the calls to the source code, or at least understanding the core concepts. I might be wrong and further testing is needed.

    Kf

    import queasycam.*;
    
    QueasyCam cam;
    float counter;
    
    void setup() {
      size(400, 400, P3D);
    
      cam = new QueasyCam(this);
      cam.sensitivity = 0.5;
      cam.speed = 0.1;
      perspective(PI/3, (float)width/height, 0.01, 10000);
    
      counter = 0;
    }
    
    void draw() {
      background(51);
    
      //ROLL effect
      if ( keyPressed && key == ' ') {
        rotateZ(map(mouseX, 0, width, -PI/4, 0));
      }
    
      counter += 0.005;
    
      for (float x=-10; x<10; x++) {
        for (float y=-10; y<10; y++) {
          float z = noise(x/33 + counter, y/33 + counter) * 50;
          pushMatrix();
          translate(x * 5, z, y * 5);
          float r = map(x, -10, 10, 100, 255);
          float g = map(y, -10, 10, 100, 255);
          float b = map(z, 0, 10, 100, 255);
          fill(r, g, b);
          box(1);
          popMatrix();
        }
      }
    }
    
  • edited July 2017

    Quesycam does not implement roll.

    You can see the implementation of pan and tilt here:

    You could fork the library, add roll for your own purposes, and submit a pull request.

    It looks like the key issue is that forward is defined based on pan and tilt (makes sense) but that if you add roll then you will need to incorporate that into the definitions of right and up. Those three (forward, right, up) are then used to construct the camera.

Sign In or Register to comment.