0
我正在嘗試重新創建this Three.js example。它從一組預定義的塊面生成地形幾何。然而,簡單地複製代碼開始,我遇到了一個問題。在three.js中轉換基本幾何
這裏是用於從例如一個塊面的代碼:
var pxGeometry = new THREE.PlaneGeometry(100, 100);
pxGeometry.faces[ 0 ].vertexColors = [ light, shadow, light ];
pxGeometry.faces[ 1 ].vertexColors = [ shadow, shadow, light ];
pxGeometry.faceVertexUvs[ 0 ][ 0 ][ 0 ].y = 0.5;
pxGeometry.faceVertexUvs[ 0 ][ 0 ][ 2 ].y = 0.5;
pxGeometry.faceVertexUvs[ 0 ][ 1 ][ 2 ].y = 0.5;
pxGeometry.rotateY(Math.PI/2);
pxGeometry.translate(50, 0, 0);
這拋出pxGeometry.rotateY is not a function
。
據我所知,旋轉和翻譯功能在PlaneGeometry
默認情況下不可用。但是,如果是這種情況,我無法看到這些示例中添加了哪些內容。
如何在Three.js中旋轉,平移和縮放基本幾何圖形?
您引用的示例確實使用了r74。 – gaitat
@gaitat我更新了問題。我只是直接複製代碼並添加了最新的cdn,所以我認爲一定是問題所在。這就是說,我仍然無法找到問題。 –
那麼問題不在您發佈的代碼中。這裏是你的代碼使用R74擺弄沒有錯誤:http://jsfiddle.net/8fhxw4je/ – gaitat