Tengo este código que genera cilindros en la posición de cada Poi (sprite), así que quiero establecer una distancia entre el cilindro y el sprite, ¿cómo puedo hacerlo?
const THREE = this.context.three; const textureLoader = new THREE.TextureLoader(); const geometry = new THREE.CylinderGeometry( 0.09, 0.09, 5, 5 ); geometry.rotateZ(-Math.PI * 0.5); const material = new THREE.MeshBasicMaterial( {color: 0xFF00FF } ); const cylinder = new THREE.Mesh( geometry, material ); if (!this.inputs.sprite) { return; } if (!this.inputs.sprite.startsWith('/assets/')) { textureLoader.crossOrigin = 'Anonymous'; } let map; if (this.inputs.sprite.indexOf('.gif') !== -1) { map = new GifLoader().load(this.inputs.sprite); } else { map = textureLoader.load(this.inputs.sprite); } map.minFilter = THREE.LinearFilter; map.wrapS = map.wrapT = THREE.ClampToEdgeWrapping; this.material = new THREE.SpriteMaterial( { map, color: this.inputs.color, fog: false } ); this.material.alphaTest = 0.5; this.material.map.encoding = THREE.sRGBEncoding; this.sprite = new THREE.Sprite( this.material ); this.sprite.add(cylinder); this.onObjectReady(this.sprite, true);Dado que agrega el cilindro como elemento secundario del sprite, puede definir una posición de desplazamiento para el cilindro. Sentido:
cylinder.position.x = 2;Suponiendo que no se aplica escala a los nodos del cilindro y sus ancestros, la distancia desde el cilindro hasta la posición de los sprites sería de 2 unidades mundiales.