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

131
Visualizações
THREEjs rotating starfield

I have a threejs scene, created in typescript in an Angular app. I have a light, camera, and a torus knot. The torus knot rotates.

I added a starfield with this function

  private scene: THREE.Scene;
  private stars: THREE.Group;

  addStar = () => {
    const geometry = new THREE.SphereGeometry(0.25, 24, 24);
    const material = new THREE.MeshStandardMaterial({
      color: 0xffffff,
      emissive: 0xffffff,
      emissiveIntensity: 1,
      roughness: 0,
      metalness: 0.5
    });
    const star = new THREE.Mesh(geometry, material);

    const [x, y, z] = Array(3)
      .fill(undefined)
      .map(() => THREE.MathUtils.randFloatSpread(100));

    star.position.set(x, y, z);
    this.stars = new THREE.Group();
    this.stars.add(star);
    this.scene.add(this.stars);
  };

Then, in my createScene function I call it

    Array(200).fill(undefined).forEach(this.addStar);

and 200 stars are indeed added to my scene, at random locations as expected.

However, in my animate function I am trying to rotate the start group around its center

    this.stars.rotation.y += 0.005;

but I only see 1 star moving. What did I miss?

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