当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript PerspectiveCamera.lookAt方法代码示例

本文整理汇总了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;
}
开发者ID:ygoto3,项目名称:sample-threejs-typescript,代码行数:7,代码来源:three.ts

示例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;
        }, () => {
开发者ID:yyjhao,项目名称:galaxy-tunnel,代码行数:12,代码来源:display.ts

示例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;
 }
开发者ID:403177368,项目名称:all,代码行数:28,代码来源:index.ts

示例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
开发者ID:nbabanov,项目名称:threejs-playground,代码行数:31,代码来源:main.ts

示例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()
开发者ID:pinqy520,项目名称:three-typescript-starter,代码行数:30,代码来源:index.ts


注:本文中的THREE.PerspectiveCamera.lookAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。