Three.js - 无法创建圆柱体
我正在尝试创建一个圆柱体,但没有成功。 这是我的代码:
geometry02 = new THREE.CylinderGeometry( 20, 100, 100, 1000 );
material02 = new THREE.MeshBasicMaterial({color: 0x0000ff});
cylinder02 = new THREE.Mesh( geometry02, material02 );
cylinder02.position.x = 300;
scene.addObject( cylinder02 );
我是否忘记包含某些内容?
I'm trying to create a Cylinder but with no success.
This is my code:
geometry02 = new THREE.CylinderGeometry( 20, 100, 100, 1000 );
material02 = new THREE.MeshBasicMaterial({color: 0x0000ff});
cylinder02 = new THREE.Mesh( geometry02, material02 );
cylinder02.position.x = 300;
scene.addObject( cylinder02 );
Am I forgetting to include something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您刚刚发布的片段没有任何问题。如果我粘贴一个示例,我可以确认它运行正常。
确保:
camera.lookAt(yourObject);
是一个好方法那)作为旁注,您可能希望将segmentsRadius参数(1000)减少到较小的值。您可能会得到类似的外观/级别细节,但顶点/面较少。
There is nothing wrong with the snippet you just posted. I can confirm it runs ok if I paste in an example.
Make sure that:
camera.lookAt(yourObject);
is a good way to do that)As a side note, you might want to decrease the segmentsRadius parameter(1000) to a smaller value. You might get a similar look/level detail with less vertices/faces.
请尝试下面的代码
Please try below code