Rendering a 3D shape from a File

Hello!
I would like to know if there is some how to render a 3D shape on .svg or .obj, like any file from this website: https://www.tinkercad.com/things
I try’d to use Pshape object but didan’t work properly

PShape s;

void setup() {
  size(1200,700,P3D);
  // The file "bot.svg" must be in the data folder
  // of the current sketch to load successfully
  s = loadShape("tinker.obj"); //or .svg
}

int x=0;
void draw() {
  background(100);
  fill(255);
  translate(width/2,height/2);
  rotateX(radians(x));
  shape(s, 0,0,200,200);
  x++;
}
1 Like

I believe svg files are two-dimensional, while object files are 3D. On the page https://processing.org/reference/loadShape_.html they use two parameters instead of four for shape(s, 0,0,200,200);. Does adjusting that fix your issue?

3 Likes

Yep, the .obj with 2 parameter works! It’s the only thing that i haven’t tried haha. Thanks

1 Like

You can place it in 3D space using translate with 3 parameters and then shape with 0,0

2 Likes