当有人单击按钮以在对象周围移动相机时,我正在尝试。但我不想移动对象(它需要居中)。
我有:
和js函数
function MoveUp()
{
camera.position.y -=50;
}
function MoveDown()
{
camera.position.y +=50;
}
但是当我单击按钮时,这是向下/向上移动对象。是否有任何可能只是移动相机周围以及如何?我的对象只是立方体..示例:
var geometry = new THREE.CubeGeometry( 50, 50, 50 );
var material = new THREE.MeshFaceMaterial( [
new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'drvo.jpg' ) } ),
new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'drvo.jpg' ) } ),
new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'drvo.jpg' ) } ),
new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'beton.jpg' ) } ),
new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'beton.jpg' ) } ),
new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'beton.jpg' ) } )
] );
cube = new THREE.Mesh( geometry, material );
cube.position.z = 450;
scene.add(cube);