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

168
Views
Cómo hacer un bucle de GlftModel con troisjs en Vue

Oye, quiero hacer un bucle en un modelo 3D que creé, pero si trato de ejecutar este código, no hace un bucle, solo lo ejecuta una vez y luego se detiene y no devuelve ningún error. Espero que puedas ayudarme

 <template> <Renderer ref="renderer" antialias orbit-ctrl resize="window"> <Camera ref="cam" :position="{ z: 40, x: 3 }"></Camera> <Scene :background="'white'"> <AmbientLight color="#808080"></AmbientLight> <PointLight color="#ffffff" :position="{ y: 50, z: 0 }"></PointLight> <PointLight color="#ffffff" :position="{ y: -50, z: 0 }"></PointLight> <PointLight color="#ffffff" :position="{ y: 0, z: 0 }"></PointLight> <GltfModel ref="model" :rotation="{ y: 0.2, x: 0.1, z: 1}" src="http://192.168.178.23:8080/car.gltf"/> </Scene> </Renderer> </template> <script> import { Camera, PointLight, Renderer, Scene, GltfModel, AmbientLight } from 'troisjs'; export default { name: 'Car', components: { Camera, PointLight, Renderer, Scene, GltfModel, AmbientLight }, mounted() { const renderer = this.$refs.renderer const box = this.$refs.model renderer.onBeforeRender(() => { box.rotation.x += 0.01; }); }, }; </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar .traverse o .traverseVisible asegurándose de que el objeto sea una malla.

 renderer.onBeforeRender(() => { box.traverse((obj3D) => { if (obj3D instanceof Mesh) { // Make sure this object is a mesh. obj3D.rotation.x += 0.01; } }) });

La devolución de llamada se invocaría en el objeto actual ( box en este caso) y todos sus descendientes.

https://tresjs.org/docs/index.html?q=object#api/en/core/Object3D.traverse

about 4 years ago · Juan Pablo Isaza Report
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!