[Solved] How to use peasy cam without affecting the text position?

Hi, Here I was trying to create a 3D box and top of that I was showing text so when I use peasycam it rotates and zooms everything in the sketch but don't want to transform and translate text other than box. help me !

I thought hint() would work but it doesn't.

import peasy.*;
PeasyCam cam;

void setup() {
  size(200, 200, P3D);
  cam = new PeasyCam(this, 100);
  cam.setMinimumDistance(50);
  cam.setMaximumDistance(500);
}
void draw() {
  //rotateX(-.5);
  //rotateY(-.5);
  background(0);
  pushMatrix();
  hint(DISABLE_DEPTH_TEST);
  fill(255, 0, 0);
  box(30);
  popMatrix();
  hint(ENABLE_DEPTH_TEST);
  fill(-1);
  text("CENTER", width/2, height/2);
}

Answers

  • Answer ✓

    Use cam.beginHUD(); and 'cam.endHUD()`.

    http://mrfeinberg.com/peasycam/reference/index.html

  • @clankill3r : Awesome :) Thank you so much

    I am sharing this those who needs it

    import peasy.*;
    PeasyCam cam;
    
    void setup() {
      size(200, 200, P3D);
      cam = new PeasyCam(this, 100);
      cam.setMinimumDistance(50);
      cam.setMaximumDistance(500);
    }
    void draw() {
      //rotateX(-.5);
      //rotateY(-.5);
    
      background(0);
      pushMatrix();
      fill(255, 0, 0);
      box(30);
      popMatrix();
      //-----------Stopping peasy ------
      cam.beginHUD();
      fill(-1);
      text("CENTER", width/2, height/2);
      cam.endHUD();
      //--------------------------------
    }
    
Sign In or Register to comment.