代码之家  ›  专栏  ›  技术社区  ›  user824624

几何学三个属性中的属性为空。js 0.124

  •  0
  • user824624  · 技术社区  · 4 年前

        const segment = 25
        const geometry = new THREE.PlaneGeometry(dimension, dimension, segment, segment)
        for (let i = 0; i < vertices; i++) {
                const idx = i * vertices
                const fVal = (simplex.noise2D(ni, nj) + 1) / 2
                const sVal = (0.5 * simplex.noise2D(ni * 2, nj * 2) + 1) / 2
                const tVal = (0.25 * simplex.noise2D(ni * 4, nj * 4) + 1) / 2
                const vtx = (fVal + sVal + tVal) / 2.15
                geometry.attributes.position.setY(idx, Math.pow(vtx, 2.5) * 350)
        }
    
    The application throws out an error saying: TypeError: Cannot read properties of undefined (reading 'position'), which points out geometry.attributes is null.
    

    我的三个。js版本是0.124,目前我不想将其更新为0.125,因为有许多功能依赖于当前版本。

    我将如何解决这个问题。

    0 回复  |  直到 4 年前