Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

InstancedMesh nothing displayed #80

Answered by IRobot1
Diimsch asked this question in Q&A
Discussion options

You must be logged in to vote

I found this three.js instancing example very help in figure this out. This was one of the examples from the three.js InstancedMesh documentation

    <ngt-instanced-mesh #inst="ngtInstancedMesh" [args]="[data.length]" (ready)="ready(inst.mesh)">
      <ngt-box-geometry></ngt-box-geometry>
      <ngt-mesh-standard-material></ngt-mesh-standard-material>
    </ngt-instanced-mesh>
  gap = 1.05
  data = new Array(1000).fill(0).map((d, index) => ({
    position: new Vector3(0, Math.floor(index / 30) * this.gap, (index % 30) * this.gap - 15),
    color: new Color().setColorName('white') //.setHex( Math.random() * 0xffffff ) )
  }));

  ready(inst: InstancedMesh) {
    const matrix = new Matrix4();

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Diimsch
Comment options

Comment options

You must be logged in to vote
1 reply
@Diimsch
Comment options

Answer selected by Diimsch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants