本文整理汇总了TypeScript中THREE.PerspectiveCamera.lookAt方法的典型用法代码示例。如果您正苦于以下问题:TypeScript PerspectiveCamera.lookAt方法的具体用法?TypeScript PerspectiveCamera.lookAt怎么用?TypeScript PerspectiveCamera.lookAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THREE.PerspectiveCamera
的用法示例。
在下文中一共展示了PerspectiveCamera.lookAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createCamera
export function createCamera(fov: number, aspect: number, position: THREE.Vector3, up: THREE.Vector3): THREE.PerspectiveCamera {
const camera = new PerspectiveCamera(fov, aspect, 1, 10000);
assign(camera.position, position);
assign(camera.up, up);
camera.lookAt( new Vector3(0, 0, 0) );
return camera;
}
示例2: super
super(container, motionTracker, (scene: Scene, renderer: WebGLRenderer) => {
var camera = new PerspectiveCamera(100, window.innerWidth / window.innerHeight, 50, 1000000);
scene.add(camera);
scene.add(new AmbientLight(0xffdddd, 0.1))
camera.position.z = 0;
camera.lookAt(new Vector3(0, 0, 500));
light = new SpotLight(0xffffff, 1, 7000, 0.6, 1, 2);
light.add(new PointLight(0xffffff, 0.4, 5000));
scene.add(light);
return camera;
}, () => {
示例3: createCamera
// handleKeys() {
// if (this.keys.KeyA === true) {
// camera.position.x -= 5;
// }
// if (this.keys.KeyD === true) {
// camera.position.x += 5;
// }
// }
createCamera() {
this.HEIGHT = window.innerHeight;
this.WIDTH = window.innerWidth;
this.aspectRatio = this.WIDTH / this.HEIGHT;
this.fieldOfView = 60;
this.nearPlane = 1;
// How far the camera can reach
this.farPlane = 10000;
var camera = new THREE.PerspectiveCamera(
this.fieldOfView,
this.aspectRatio,
this.nearPlane,
this.farPlane
);
camera.position.x = 0;
camera.position.z = -1000;
camera.position.y = 1000;
camera.lookAt(new THREE.Vector3(0, 0, 0));
return camera;
}
示例4: Snake
};
let playerOrientation = Orientation.RIGHT;
const snake = new Snake(new Vector3(0, 0, 0), SNAKE_COLOR, playerOrientation, scene);
// For illustrating purposes, until the food spawn mechanic is ready
snake.eat();
snake.eat();
snake.eat();
snake.eat();
snake.eat();
camera.position.z = 15;
camera.lookAt(snake.getPosition());
// create a point light
const pointLight = new PointLight(LIGHT_COLOR);
// set its position
pointLight.position.x = 10;
pointLight.position.y = 50;
pointLight.position.z = 130;
// add to the scene
scene.add(pointLight);
renderer.setClearColor(BACKGROUND_COLOR);
// Event listener for the controls
示例5: animate
wireframe: true
})
// create a box and add it to the scene
let box = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), material)
scene.add(box)
box.position.x = 0.5
box.rotation.y = 0.5
camera.position.x = 5
camera.position.y = 5
camera.position.z = 5
camera.lookAt(scene.position)
function animate(): void {
requestAnimationFrame(animate)
render()
}
function render(): void {
let timer = 0.002 * Date.now()
box.position.y = 0.5 + 0.5 * Math.sin(timer)
box.rotation.x += 0.1
renderer.render(scene, camera)
}
animate()