Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
Cómo superponer objetos 3d en p5.js usando WEBGL

Tengo 2 objetos 3D, un toro y un cilindro. Quiero que el cilindro quede encima del toro, en lugar de debajo.

 function setup() { createCanvas(400, 400, WEBGL); } function draw() { angleMode(DEGREES) background(220); noStroke(); rotateX(30) // The torus // The color(Torus) fill(241, 177, 102); // Drawing the Torus torus(100, 40); // The Cylinder // The color fill(138, 78, 27); // Drawing the cylinder push(); rotateX(90); cylinder(130, 10); pop(); }
 <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.1/p5.js"></script>

En este dibujo, el cilindro parecerá más obvio, ya que esta vez está de lado en lugar de estar plano como si fuera un círculo. Esto es simplemente para que sea más fácil ver y entender lo que quiero decir.

 function setup() { createCanvas(400, 400, WEBGL); } function draw() { angleMode(DEGREES) background(220); noStroke(); // rotateX(30) // The torus // The color(Torus) fill(241, 177, 102); // Drawing the Torus torus(100, 40); // The Cylinder // The color fill(138, 78, 27); // Drawing the cylinder // push(); // rotateX(90); cylinder(130, 10); // pop(); }
 <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.1/p5.js"></script>

Hasta ahora, he intentado rotar el cilindro sobre el eje Z, pero no funcionó, y también intenté dibujar el cilindro antes del toro, pero tampoco funcionó.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!