0

I got a 2D Hexagon in my init()-Code, works well. I push 6 vertices and new faces, but nothing appear. Why?

for-loop:

    b.world.grid[x][z].Model.geometry.vertices.push(new THREE.Vector3(b.world.grid[x]       [z].Model.geometry.vertices[i].x,b.world.grid[x][z].Model.geometry.vertices[i].y,b.world.grid[x]        [z].Model.geometry.vertices[i].z));

    b.world.grid[x][z].Model.geometry.faces.push(new THREE.Face3(0, 1, 7));

I already used VerticesNeedUpdate

WestLangley
  • 102,557
  • 10
  • 276
  • 276
mcode
  • 456
  • 5
  • 18

1 Answers1

2

Have you tried this code:

b.world.grid[x][y].Model.geometry.groupsNeedUpdate = true;

You need to update the group, not the vertices array, because the existing vertices haven't changed — you have just added some more, but you need to update the group of your existing model.

Antti29
  • 2,953
  • 12
  • 34
  • 36
fmh
  • 56
  • 3