Rotate OBJ file / trouble shoot deformation

Hello, I am simply trying to rotate a custom obj file which doesn't rotate. I can do it with a spere easily; however, when I use PeasyCam my object is flattened/deformed. Maybe I don't understand the parameters of the shape()? Regardless, I don't with to use peasy cam, just to rotate it around an axis in the window.

PShape s;

void setup() {
  size(500, 500, P3D);
  shapeMode(CENTER);
  s = loadShape("obj2.obj");
}

void draw() {
  background(32);
  lights();
  fill(255);
  float z = 0;
  rotateY(z);
  z += .1;
  shape(s, 100,100, 50,50);
}

Answers

  • Your code calls the rotate method with the same value:

    rotateY(0);

    since you are re-defining the z value every time you run the draw function.

    Try this

    rotateY(map(mouseX,0,width,0,TWO_PI));

    Kf

  • Or move line 13 to line 2

Sign In or Register to comment.