Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
¿Por qué la función axesHelper no muestra el eje en la pantalla?

Tengo un problema con mi código. Estoy usando three.js y tratando de inicializar los componentes. Los objetos que se inicializan no se muestran en la pantalla como eje, cubo. Indique dónde puede estar el error.

 function gameInit(axlesHelper) { (axlesHelper) ? gameComponent.setAxlesHelper() : null ; gameComponent.setAambientLight(); gameComponent.setDirectionalLight(); gameComponent.setCameraPosition(); gameComponent.renderer(); } var gameComponent = { scene : new THREE.Scene(), axesHelper : new THREE.AxesHelper( 10 ), ambientLight : new THREE.AmbientLight(0xffffff, 0,6), directionalLight : new THREE.DirectionalLight(0xffffff, 1), aspect : window.innerWidth / window.innerHeight, width : 10, height : this.width / this.aspect, camera : new THREE.OrthographicCamera( this.width * -2, // left this.width * 2, // right this.height * 2, // top this.height * -2, // bottom 0, // near plane 10000 // far plane ), render : new THREE.WebGLRenderer({antialias : true}), setAxlesHelper : function() { console.log('wywołano axlesHelper'); this.scene.add( this.axesHelper ); }, . . . renderer : function(){ console.log('wywołano renderer'); this.render.setSize(window.innerWidth, window.innerHeight); this.render.render(this.scene, this.camera); document.body.appendChild(this.render.domElement); }, rendererUpdate : function(){ console.log('wywołano renderer update'); this.render.render(this.scene, this.camera); } } gameInit(true);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

 height : this.width / this.aspect, camera : new THREE.OrthographicCamera( this.width * -2, // left this.width * 2, // right this.height * 2, // top this.height * -2, // bottom 0, // near plane 10000 // far plane ),

Este código no es válido. Acceder a las propiedades a través de this da como resultado undefined . Por lo tanto, su cámara tiene valores de NaN que rompen la representación. Pruébalo así:

 function gameInit(axlesHelper) { (axlesHelper) ? gameComponent.setAxlesHelper(): null; gameComponent.renderer(); } const width = 10; const height = width / ( window.innerWidth / window.innerHeight ); var gameComponent = { scene: new THREE.Scene(), axesHelper: new THREE.AxesHelper(10), ambientLight: new THREE.AmbientLight(0xffffff, 0, 6), directionalLight: new THREE.DirectionalLight(0xffffff, 1), camera: new THREE.OrthographicCamera( width * -2, // left width * 2, // right height * 2, // top height * -2, // bottom 0, // near plane 10000 // far plane ), render: new THREE.WebGLRenderer({ antialias: true }), setAxlesHelper: function() { this.scene.add(this.axesHelper); }, renderer: function() { this.render.setSize(window.innerWidth, window.innerHeight); this.render.render(this.scene, this.camera); document.body.appendChild(this.render.domElement); }, rendererUpdate: function() { console.log('wywołano renderer update'); this.render.render(this.scene, this.camera); } } gameInit(true);
 body { margin: 0; }
 <script src="https://cdn.jsdelivr.net/npm/three@0.136.0/build/three.min.js"></script>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda