Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda