提交 ca90b0aa 编写于 作者: M Mr.doob

Cleaned up lookAt() example. Minor tweaks.

上级 104389c5
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
var camera, scene, renderer; var camera, scene, renderer;
var mesh, zmesh, lightMesh, geometry, sphere; var mesh, geometry, sphere;
var mouseX = 0, mouseY = 0; var mouseX = 0, mouseY = 0;
...@@ -125,9 +125,9 @@ ...@@ -125,9 +125,9 @@
sphere.position.y = Math.cos( time * 0.5 ) * 2000; sphere.position.y = Math.cos( time * 0.5 ) * 2000;
sphere.position.z = Math.cos( time * 0.3 ) * 2000; sphere.position.z = Math.cos( time * 0.3 ) * 2000;
for ( var i = 0, l = scene.objects.length; i < l; i ++ ) { for ( var i = 1, l = scene.children.length; i < l; i ++ ) {
scene.objects[ i ].lookAt( sphere.position ); scene.children[ i ].lookAt( sphere.position );
} }
......
...@@ -70,11 +70,11 @@ THREE.Matrix4.prototype = { ...@@ -70,11 +70,11 @@ THREE.Matrix4.prototype = {
}, },
lookAt: function ( eye, center, up ) { lookAt: function ( eye, target, up ) {
var x = THREE.Matrix4.__v1, y = THREE.Matrix4.__v2, z = THREE.Matrix4.__v3; var x = THREE.Matrix4.__v1, y = THREE.Matrix4.__v2, z = THREE.Matrix4.__v3;
z.sub( eye, center ).normalize(); z.sub( eye, target ).normalize();
if ( z.length() === 0 ) { if ( z.length() === 0 ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册