【发布时间】:2022-01-24 00:05:40
【问题描述】:
我无法访问 THREE.js 中任何类型几何的 .attributes.position。基本上,控制台错误是 'Uncaught TypeError: Cannot read properties of undefined (reading 'position')'。
const cylinderGeometry = new THREE.CylinderGeometry( 5, 5, 5, 5, 15, 5, 30 );
const position = cylinderGeometry.attributes.position;
const vertex = new THREE.Vector3();
作为参考,sn-p 取自https://threejs.org/docs/#api/en/objects/SkinnedMesh。
知道为什么会发生这种情况吗?会不会和我使用的 THREE.js 版本有关?
【问题讨论】:
-
如果您使用的是 r125 之前的版本,那么
CylinderGeometry是Geometry,而不是BufferGeometry。尝试使用CylinderBufferGeometry。
标签: javascript three.js threejs-editor