我创建了一个圆柱体几何形状的圆锥体。然后当我想用lookAt函数旋转圆锥指向X轴的正方向时,它就不起作用了。我的代码有什么问题吗?或者这是 Three.js 的错误?
您还可以在 jsFiddle 上查看我的代码:http: //jsfiddle.net/ysmood/CRdxP/
class Stage
constructor: ->
@init_scene()
@make_meshes()
init_scene: ->
@scene = new THREE.Scene
# Renderer
width = window.innerWidth;
height = window.innerHeight;
@renderer = new THREE.WebGLRenderer({
canvas: document.querySelector('.scene')
})
@renderer.setSize(width, height)
# Camera
@camera = new THREE.PerspectiveCamera(
45, # fov
width / height, # aspect
1, # near
1000 # far
)
@camera.position.z = 200;
@scene.add(@camera)
make_meshes: ->
size = 20
@mesh = new THREE.Mesh(
new THREE.CylinderGeometry(
0, size, size
),
new THREE.MeshNormalMaterial()
)
@scene.add(@mesh)
# I want the mesh's tip point to right, but it doesn't work.
@mesh.lookAt(new THREE.Vector3(1, 0, 0))
draw: =>
@renderer.render(@scene, @camera)
stage = new Stage
stage.draw()