|
@@ -1,436 +1,415 @@
|
|
<!DOCTYPE html>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<html lang="en">
|
|
- <head>
|
|
|
|
- <meta charset="utf-8" />
|
|
|
|
- <base href="../../../" />
|
|
|
|
- <script src="list.js"></script>
|
|
|
|
- <script src="page.js"></script>
|
|
|
|
- <link type="text/css" rel="stylesheet" href="page.css" />
|
|
|
|
- </head>
|
|
|
|
- <body>
|
|
|
|
- <h1>三维物体([name])</h1>
|
|
|
|
|
|
|
|
- <p class="desc">
|
|
|
|
- 这是Three.js中大部分对象的基类,提供了一系列的属性和方法来对三维空间中的物体进行操纵。<br /><br />
|
|
|
|
|
|
+<head>
|
|
|
|
+ <meta charset="utf-8" />
|
|
|
|
+ <base href="../../../" />
|
|
|
|
+ <script src="list.js"></script>
|
|
|
|
+ <script src="page.js"></script>
|
|
|
|
+ <link type="text/css" rel="stylesheet" href="page.css" />
|
|
|
|
+</head>
|
|
|
|
|
|
- 请注意,它可以通过[page:.add]( object )方法来将对象进行组合,该方法将对象添加为子对象,但为此最好使用[page:Group](来作为父对象)。
|
|
|
|
- </p>
|
|
|
|
|
|
+<body>
|
|
|
|
+ <h1>三维物体([name])</h1>
|
|
|
|
|
|
|
|
+ <p class="desc">
|
|
|
|
+ 这是Three.js中大部分对象的基类,提供了一系列的属性和方法来对三维空间中的物体进行操纵。<br /><br />
|
|
|
|
|
|
- <h2>构造器</h2>
|
|
|
|
|
|
+ 请注意,可以通过[page:.add]( object )方法来将对象进行组合,该方法将对象添加为子对象,但为此最好使用[page:Group](来作为父对象)。
|
|
|
|
+ </p>
|
|
|
|
|
|
|
|
|
|
- <h3>[name]()</h3>
|
|
|
|
- <p>
|
|
|
|
- 构造器中不带有参数。
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h2>构造器</h2>
|
|
|
|
|
|
|
|
|
|
- <h2>属性</h2>
|
|
|
|
|
|
+ <h3>[name]()</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 构造器中不带有参数。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:Boolean castShadow]</h3>
|
|
|
|
- <p>对象是否被渲染到阴影贴图中。默认值为*false*。</p>
|
|
|
|
|
|
|
|
- <h3>[property:Object3D children]</h3>
|
|
|
|
- <p>含有对象的子级的数组。请参阅[page:Group]来了解将手动对象进行分组的相关信息。</p>
|
|
|
|
|
|
+ <h2>属性</h2>
|
|
|
|
|
|
- <h3>[property:Boolean frustumCulled]</h3>
|
|
|
|
- <p>
|
|
|
|
- 当这个属性被设置的时候,它将在渲染物体之前,检查每一帧的物体是否在摄像机的视锥体中。
|
|
|
|
- 否则,即使该物体不可见,它也将在每一帧中被渲染,默认值为*true*。
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[property:Integer id]</h3>
|
|
|
|
- <p>只读 —— 表示该对象实例ID的唯一数字。</p>
|
|
|
|
|
|
+ <h3>[property:Boolean castShadow]</h3>
|
|
|
|
+ <p>对象是否被渲染到阴影贴图中。默认值为*false*。</p>
|
|
|
|
|
|
- <h3>[property:Boolean isObject3D]</h3>
|
|
|
|
- <p>
|
|
|
|
- Used to check whether this or derived classes are Object3Ds. Default is *true*.<br /><br />
|
|
|
|
-
|
|
|
|
- You should not change this, as it is used internally for optimisation.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[property:Layers layers]</h3>
|
|
|
|
- <p>
|
|
|
|
- The layer membership of the object. The object is only visible if it has at least one
|
|
|
|
- layer in common with the [page:Camera] in use.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[property:Matrix4 matrix]</h3>
|
|
|
|
- <p>The local transform matrix.</p>
|
|
|
|
|
|
+ <h3>[property:Object3D children]</h3>
|
|
|
|
+ <p>含有对象的子级的数组。请参阅[page:Group]来了解将手动对象进行分组的相关信息。</p>
|
|
|
|
|
|
- <h3>[property:Boolean matrixAutoUpdate]</h3>
|
|
|
|
- <p>
|
|
|
|
- When this is set, it calculates the matrix of position, (rotation or quaternion) and
|
|
|
|
- scale every frame and also recalculates the matrixWorld property. Default is [page:Object3D.DefaultMatrixAutoUpdate] (true).
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Boolean frustumCulled]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 当这个属性被设置的时候,它将在渲染物体之前,检查每一帧的物体是否在摄像机的视锥体中。
|
|
|
|
+ 否则,即使该物体不可见,它也将在每一帧中被渲染,默认值为*true*。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:Matrix4 matrixWorld]</h3>
|
|
|
|
- <p>
|
|
|
|
- The global transform of the object. If the Object3D has no parent, then it's identical to
|
|
|
|
- the local transform [page:.matrix].
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Integer id]</h3>
|
|
|
|
+ <p>只读 —— 表示该对象实例ID的唯一数字。</p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:Boolean isObject3D]</h3>
|
|
|
|
+ <p>
|
|
|
|
+
|
|
|
|
+ 用于测试这个类或者派生类是否为Object3D,默认为*true*。<br /><br />
|
|
|
|
+ 你不应当对这个属性进行改变,因为它在内部使用,以用于优化。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:Layers layers]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 物体的层级关系。
|
|
|
|
+ 物体只有和一个正在使用的[page:Camera]至少在同一个层时才可见。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:Boolean matrixWorldNeedsUpdate]</h3>
|
|
|
|
- <p>
|
|
|
|
- When this is set, it calculates the matrixWorld in that frame and resets this property
|
|
|
|
- to false. Default is *false*.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[property:Matrix4 modelViewMatrix]</h3>
|
|
|
|
- <p>This is passed to the shader and used to calculate the position of the object.</p>
|
|
|
|
-
|
|
|
|
- <h3>[property:String name]</h3>
|
|
|
|
- <p>Optional name of the object (doesn't need to be unique). Default is an empty string.</p>
|
|
|
|
|
|
+ <h3>[property:Matrix4 matrix]</h3>
|
|
|
|
+ <p>局部变换矩阵。</p>
|
|
|
|
|
|
- <h3>[property:Matrix3 normalMatrix]</h3>
|
|
|
|
- <p>
|
|
|
|
- This is passed to the shader and used to calculate lighting for the object. It is the transpose of the inverse of the upper left 3x3 sub-matrix of this object's modelViewMatrix.<br /><br />
|
|
|
|
|
|
+ <h3>[property:Boolean matrixAutoUpdate]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 当这个属性设置了之后,它将计算每一帧的位移、旋转(四元变换)和缩放矩阵,并重新计算matrixWorld属性。默认值是[page:Object3D.DefaultMatrixAutoUpdate] (true)。
|
|
|
|
+ </p>
|
|
|
|
|
|
- The reason for this special matrix is that simply using the modelViewMatrix could result in a non-unit length of normals (on scaling) or in a non-perpendicular direction (on non-uniform scaling).<br /><br />
|
|
|
|
|
|
+ <h3>[property:Matrix4 matrixWorld]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 物体的世界变换。若这个Object3D没有父级,则它将和local transform [page:.matrix](局部变换矩阵)相同。
|
|
|
|
+ </p>
|
|
|
|
|
|
- On the other hand the translation part of the modelViewMatrix is not relevant for the calculation of normals. Thus a Matrix3 is sufficient.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Boolean matrixWorldNeedsUpdate]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 当这个属性设置了之后,它将计算在那一帧中的matrixWorld,并将这个值重置为false。默认值为*false*。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:function onAfterRender]</h3>
|
|
|
|
- <p>
|
|
|
|
- An optional callback that is executed immediately after the Object3D is rendered.
|
|
|
|
- This function is called with the following parameters: renderer, scene, camera, geometry,
|
|
|
|
- material, group.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Matrix4 modelViewMatrix]</h3>
|
|
|
|
+ <p>这个值传递给着色器,用于计算物体的位置。</p>
|
|
|
|
|
|
- <h3>[property:function onBeforeRender]</h3>
|
|
|
|
- <p>
|
|
|
|
- An optional callback that is executed immediately before the Object3D is rendered.
|
|
|
|
- This function is called with the following parameters: renderer, scene, camera, geometry,
|
|
|
|
- material, group.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:String name]</h3>
|
|
|
|
+ <p>对象的名称,可选、不必唯一。默认值是一个空字符串。</p>
|
|
|
|
|
|
- <h3>[property:Object3D parent]</h3>
|
|
|
|
- <p>Object's parent in the [link:https://en.wikipedia.org/wiki/Scene_graph scene graph]. An object can have at most
|
|
|
|
- one parent.</p>
|
|
|
|
|
|
+ <h3>[property:Matrix3 normalMatrix]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 这个值传递给着色器,用于计算物体的光照。
|
|
|
|
+ 它是物体的modelViewMatrix矩阵中,左上角3x3子矩阵的逆的转置矩阵。
|
|
|
|
+ <br /><br />
|
|
|
|
+ 使用这个特殊矩阵的原因,是只需使用modelViewMatrix就可以得出一个法线(缩放时)的非单位长度或者非垂直的方向(不规则缩放时)。
|
|
|
|
+ <br /><br />
|
|
|
|
+ 另一方面,modelViewMatrix矩阵中的位移部分和法线的计算无关,因此Matrix3就已经足够了。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:Vector3 position]</h3>
|
|
|
|
- <p>A [page:Vector3] representing the object's local position. Default is (0, 0, 0).</p>
|
|
|
|
|
|
+ <h3>[property:function onAfterRender]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 一个可选的回调函数,在Object3D渲染之后直接执行。
|
|
|
|
+ 使用以下参数来调用此函数:renderer,scene,camera,geometry,material,group。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:Quaternion quaternion]</h3>
|
|
|
|
- <p>Object's local rotation as a [page:Quaternion Quaternion].</p>
|
|
|
|
|
|
+ <h3>[property:function onBeforeRender]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 一个可选的回调函数,在Object3D渲染之前直接执行。
|
|
|
|
+ 使用以下参数来调用此函数:renderer,scene,camera,geometry,material,group。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:Boolean receiveShadow]</h3>
|
|
|
|
- <p>Whether the material receives shadows. Default is *false*.</p>
|
|
|
|
|
|
+ <h3>[property:Object3D parent]</h3>
|
|
|
|
+ <p>在[link:https://en.wikipedia.org/wiki/Scene_graph scene graph](场景图)中,一个对象的父级对象。
|
|
|
|
+ 一个对象最多仅能有一个父级对象。</p>
|
|
|
|
|
|
- <h3>[property:Number renderOrder]</h3>
|
|
|
|
- <p>
|
|
|
|
- This value allows the default rendering order of [link:https://en.wikipedia.org/wiki/Scene_graph scene graph]
|
|
|
|
- objects to be overridden although opaque and transparent objects remain sorted independently.
|
|
|
|
- Sorting is from lowest to highest renderOrder. Default value is *0*.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Vector3 position]</h3>
|
|
|
|
+ <p>表示对象局部位置的[page:Vector3]。默认值为(0, 0, 0)。</p>
|
|
|
|
|
|
- <h3>[property:Euler rotation]</h3>
|
|
|
|
- <p>
|
|
|
|
- Object's local rotation (see [link:https://en.wikipedia.org/wiki/Euler_angles Euler angles]), in radians.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Quaternion quaternion]</h3>
|
|
|
|
+ <p>表示对象局部旋转的[page:Quaternion Quaternion](四元数)。</p>
|
|
|
|
|
|
- <h3>[property:Vector3 scale]</h3>
|
|
|
|
- <p>
|
|
|
|
- The object's local scale. Default is [page:Vector3]( 1, 1, 1 ).
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[property:Vector3 up]</h3>
|
|
|
|
- <p>
|
|
|
|
- This is used by the [page:.lookAt lookAt] method, for example, to determine the orientation of the result.<br />
|
|
|
|
- Default is [page:Object3D.DefaultUp] - that is, ( 0, 1, 0 ).
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Boolean receiveShadow]</h3>
|
|
|
|
+ <p>材质是否接收阴影。默认值为*false*。</p>
|
|
|
|
|
|
- <h3>[property:object userData]</h3>
|
|
|
|
- <p>
|
|
|
|
- An object that can be used to store custom data about the Object3D. It should not hold
|
|
|
|
- references to functions as these will not be cloned.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Number renderOrder]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 这个值将使得[link:https://en.wikipedia.org/wiki/Scene_graph scene graph](场景图)中默认的的渲染顺序被覆盖,
|
|
|
|
+ 即使不透明对象和透明对象保持独立顺序。
|
|
|
|
+ 渲染顺序是由低到高来排序的,默认值为*0*。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:String uuid]</h3>
|
|
|
|
- <p>
|
|
|
|
- [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
|
|
|
|
- This gets automatically assigned, so this shouldn't be edited.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[property:Euler rotation]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 物体的局部旋转,以弧度来表示。(请参阅[link:https://en.wikipedia.org/wiki/Euler_angles Euler angles]-欧拉角)
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:Vector3 scale]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 物体的局部缩放。默认值是[page:Vector3]( 1, 1, 1 )。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:Vector3 up]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 这个属性由[page:.lookAt lookAt]方法所使用,例如,来决定结果的朝向。
|
|
|
|
+ 默认值是[page:Object3D.DefaultUp],即( 0, 1, 0 )。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:object userData]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 一个用于存储Object3D自定义数据的对象。
|
|
|
|
+ 它不应当包含对函数的引用,因为这些函数将不会被克隆。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:String uuid]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 该对象实例的[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID]。
|
|
|
|
+ 这是一个自动生成的值,不应当对其进行修改。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:Boolean visible]</h3>
|
|
|
|
+ <p>可见性。这个值为*true*时,物体将被渲染。默认值为*true*。</p>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <h2>静态属性</h2>
|
|
|
|
+ <p>
|
|
|
|
+ 静态属性和方法由每个类所定义,并非由每个类的实例所定义。
|
|
|
|
+ 也就是说,改变[page:Object3D.DefaultUp]或[page:Object3D.DefaultMatrixAutoUpdate]的值,
|
|
|
|
+ 将改变<b>每个在此之后</b>由Object3D类(或派生类)创建的实例中的[page:.up up]和[page:.matrixAutoUpdate matrixAutoUpdate]的值。(已经创建好的Object3D不会受到影响)。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:Vector3 DefaultUp]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 默认的物体的[page:.up up]方向,同时也作为[page:DirectionalLight]、[page:HemisphereLight]和[page:Spotlight](自顶向下创建的灯光)的默认方向。
|
|
|
|
+ 默认设为( 0, 1, 0 )。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[property:Vector3 DefaultMatrixAutoUpdate]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ [page:.matrixAutoUpdate matrixAutoUpdate]的默认设置,用于新创建的Object3D。<br />
|
|
|
|
+
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <h2>方法</h2>
|
|
|
|
+
|
|
|
|
+ <h3>[page:EventDispatcher EventDispatcher] 方法在这个类上是可用的。</h3>
|
|
|
|
+
|
|
|
|
+ <h3>[method:null add]( [param:Object3D object], ... )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 添加<b>对象</b>到这个对象的子级,可以添加任意数量的对象。
|
|
|
|
+ 当前传入的对象中的父级将在这里被移除,因为一个对象仅能有一个父级。<br /><br />
|
|
|
|
+ 请参阅[page:Group]来查看手动编组对象的相关信息。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:null applyMatrix]( [param:Matrix4 matrix] )</h3>
|
|
|
|
+ <p>对当前物体应用这个变换矩阵,并更新物体的位置、旋转和缩放。</p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Object3D applyQuaternion]( [param:Quaternion quaternion] )</h3>
|
|
|
|
+ <p>对当前物体应用由四元数所表示的变换。</p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Object3D clone]( [param:Boolean recursive] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ recursive —— 如果值为true,则该物体的后代也会被克隆。默认值为true。<br /><br />
|
|
|
|
+
|
|
|
|
+ 返回对象前物体的克隆(以及可选的所有后代)。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:this copy]( [param:Object3D object], [param:Boolean recursive] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ recursive —— 如果值为true,则该物体的后代也会被复制。默认值为true。<br /><br />
|
|
|
|
+ 复制给定的对象到这个对象中。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Object3D getObjectById]( [param:Integer id] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ id —— 标识该对象实例的唯一数字。<br /><br />
|
|
|
|
+
|
|
|
|
+ 搜索该对象的子级,返回第一个带有匹配id的子对象。<br />
|
|
|
|
+ 请注意,id是按照时间顺序来分配的:1、2、3、……,每增加一个新的对象就自增1。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Object3D getObjectByName]( [param:String name] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ name —— 用于来匹配子物体中Object3D.name属性的字符串。<br /><br />
|
|
|
|
+
|
|
|
|
+ 搜索该对象的子级,返回第一个带有匹配name的子对象。<br />
|
|
|
|
+ 请注意,大多数的对象中name默认是一个空字符串,要使用这个方法,你将需要手动地设置name属性。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Object3D getObjectByProperty]( [param:String name], [param:Float value] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ name —— 将要用于查找的属性的名称。<br />
|
|
|
|
+ value —— 给定的属性的值。 <br /><br />
|
|
|
|
+ 搜索该对象的子级,返回第一个给定的属性中包含有匹配的值的子对象。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Vector3 getWorldPosition]( [param:Vector3 target] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ [page:Vector3 target] — 结果将被复制到这个Vector3中。<br /><br />
|
|
|
|
+ 返回一个表示该物体在世界空间中位置的矢量。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[property:Boolean visible]</h3>
|
|
|
|
- <p>Object gets rendered if *true*. Default is *true*.</p>
|
|
|
|
|
|
+ <h3>[method:Quaternion getWorldQuaternion]( [param:Quaternion target] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ [page:Quaternion target] — 结果将被复制到这个Quaternion中。<br /><br />
|
|
|
|
+ 返回一个表示该物体在世界空间中旋转的四元数。
|
|
|
|
+ </p>
|
|
|
|
|
|
|
|
+ <h3>[method:Vector3 getWorldScale]( [param:Vector3 target] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ [page:Vector3 target] — 结果将被复制到这个Vector3中。<br /><br />
|
|
|
|
+ 返回一个包含着该物体在世界空间中各个轴向上所应用的缩放因数的矢量。
|
|
|
|
+ </p>
|
|
|
|
|
|
|
|
+ <h3>[method:Vector3 getWorldDirection]( [param:Vector3 target] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ [page:Vector3 target] — 结果将被复制到这个Vector3中。 <br /><br />
|
|
|
|
+ 返回一个表示该物体在世界空间中Z轴正方向的矢量。
|
|
|
|
+ </p>
|
|
|
|
|
|
|
|
|
|
- <h2>Static Properties</h2>
|
|
|
|
- <p>
|
|
|
|
- Static properties and methods are defined per class rather than per instance of that class.
|
|
|
|
- This means that changing [page:Object3D.DefaultUp] or [page:Object3D.DefaultMatrixAutoUpdate]
|
|
|
|
- will change the values of [page:.up up] and [page:.matrixAutoUpdate matrixAutoUpdate] for
|
|
|
|
- <em>every</em> instance of Object3D (or derived classes) created after the change has
|
|
|
|
- been made (already created Object3Ds will not be affected).
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[property:Vector3 DefaultUp]</h3>
|
|
|
|
- <p>
|
|
|
|
- The default [page:.up up] direction for objects, also used as the default position for [page:DirectionalLight],
|
|
|
|
- [page:HemisphereLight] and [page:Spotlight] (which creates lights shining from the top down).<br />
|
|
|
|
- Set to ( 0, 1, 0 ) by default.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[property:Vector3 DefaultMatrixAutoUpdate]</h3>
|
|
|
|
- <p>
|
|
|
|
- The default setting for [page:.matrixAutoUpdate matrixAutoUpdate] for newly created Object3Ds.<br />
|
|
|
|
-
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- <h2>Methods</h2>
|
|
|
|
-
|
|
|
|
- <h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
|
|
|
|
-
|
|
|
|
- <h3>[method:null add]( [param:Object3D object], ... )</h3>
|
|
|
|
- <p>
|
|
|
|
- Adds *object* as child of this object. An arbitrary number of objects may be added. Any current parent on an
|
|
|
|
- object passed in here will be removed, since an object can have at most one parent.<br /><br />
|
|
|
|
-
|
|
|
|
- See [page:Group] for info on manually grouping objects.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:null applyMatrix]( [param:Matrix4 matrix] )</h3>
|
|
|
|
- <p>Applies the matrix transform to the object and updates the object's position, rotation and scale.</p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Object3D applyQuaternion]( [param:Quaternion quaternion] )</h3>
|
|
|
|
- <p>Applies the rotation represented by the quaternion to the object.</p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Object3D clone]( [param:Boolean recursive] )</h3>
|
|
|
|
- <p>
|
|
|
|
- recursive -- if true, descendants of the object are also cloned. Default is true.<br /><br />
|
|
|
|
-
|
|
|
|
- Returns a clone of this object and optionally all descendants.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:this copy]( [param:Object3D object], [param:Boolean recursive] )</h3>
|
|
|
|
- <p>
|
|
|
|
- recursive -- if true, descendants of the object are also copied. Default is true.<br /><br />
|
|
|
|
-
|
|
|
|
- Copy the given object into this object.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Object3D getObjectById]( [param:Integer id] )</h3>
|
|
|
|
- <p>
|
|
|
|
- id -- Unique number of the object instance<br /><br />
|
|
|
|
-
|
|
|
|
- Searches through the object's children and returns the first with a matching id.<br />
|
|
|
|
- Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Object3D getObjectByName]( [param:String name] )</h3>
|
|
|
|
- <p>
|
|
|
|
- name -- String to match to the children's Object3D.name property. <br /><br />
|
|
|
|
-
|
|
|
|
- Searches through the object's children and returns the first with a matching name.<br />
|
|
|
|
- Note that for most objects the name is an empty string by default. You will
|
|
|
|
- have to set it manually to make use of this method.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Object3D getObjectByProperty]( [param:String name], [param:Float value] )</h3>
|
|
|
|
- <p>
|
|
|
|
- name -- the property name to search for. <br />
|
|
|
|
- value -- value of the given property. <br /><br />
|
|
|
|
-
|
|
|
|
- Searches through the object's children and returns the first with a property that matches the value given.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Vector3 getWorldPosition]( [param:Vector3 target] )</h3>
|
|
|
|
- <p>
|
|
|
|
- [page:Vector3 target] — the result will be copied into this Vector3. <br /><br />
|
|
|
|
-
|
|
|
|
- Returns a vector representing the position of the object in world space.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Quaternion getWorldQuaternion]( [param:Quaternion target] )</h3>
|
|
|
|
- <p>
|
|
|
|
- [page:Quaternion target] — the result will be copied into this Quaternion. <br /><br />
|
|
|
|
-
|
|
|
|
- Returns a quaternion representing the rotation of the object in world space.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Vector3 getWorldScale]( [param:Vector3 target] )</h3>
|
|
|
|
- <p>
|
|
|
|
- [page:Vector3 target] — the result will be copied into this Vector3. <br /><br />
|
|
|
|
-
|
|
|
|
- Returns a vector of the scaling factors applied to the object for each axis in world space.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Vector3 getWorldDirection]( [param:Vector3 target] )</h3>
|
|
|
|
- <p>
|
|
|
|
- [page:Vector3 target] — the result will be copied into this Vector3. <br /><br />
|
|
|
|
-
|
|
|
|
- Returns a vector representing the direction of object's positive z-axis in world space.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- <h3>[method:Vector3 localToWorld]( [param:Vector3 vector] )</h3>
|
|
|
|
- <p>
|
|
|
|
- vector - A vector representing a position in local (object) space.<br /><br />
|
|
|
|
-
|
|
|
|
- Converts the vector from local space to world space.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:null lookAt]( [param:Vector3 vector] )</br>
|
|
|
|
|
|
+ <h3>[method:Vector3 localToWorld]( [param:Vector3 vector] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ vector - 一个表示局部(物体)空间中位置的向量。 <br /><br />
|
|
|
|
+ 将局部空间向量转换为世界空间向量。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:null lookAt]( [param:Vector3 vector] )</br>
|
|
[method:null lookAt]( [param:Float x], [param:Float y], [param:Float z] )</h3>
|
|
[method:null lookAt]( [param:Float x], [param:Float y], [param:Float z] )</h3>
|
|
- <p>
|
|
|
|
- vector - A vector representing a position in world space.<br /><br />
|
|
|
|
- Optionally, the [page:.x x], [page:.y y] and [page:.z z] components of the world space position.<br /><br />
|
|
|
|
-
|
|
|
|
- Rotates the object to face a point in world space.<br /><br />
|
|
|
|
-
|
|
|
|
- This method does not support objects with rotated and/or translated parent(s).
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
|
|
|
|
- <p>
|
|
|
|
- Abstract (empty) method to get intersections between a casted ray and this object.
|
|
|
|
- Subclasses such as [page:Mesh], [page:Line], and [page:Points] implement this method in order
|
|
|
|
- to use raycasting.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:null remove]( [param:Object3D object], ... )</h3>
|
|
|
|
- <p>
|
|
|
|
- Removes *object* as child of this object. An arbitrary number of objects may be removed.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:this rotateOnAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
|
|
|
|
- <p>
|
|
|
|
- axis -- A normalized vector in object space. <br />
|
|
|
|
- angle -- The angle in radians.<br /><br />
|
|
|
|
-
|
|
|
|
- Rotate an object along an axis in object space. The axis is assumed to be normalized.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:this rotateOnWorldAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
|
|
|
|
- <p>
|
|
|
|
- axis -- A normalized vector in world space. <br />
|
|
|
|
- angle -- The angle in radians.<br /><br />
|
|
|
|
-
|
|
|
|
- Rotate an object along an axis in world space. The axis is assumed to be normalized.
|
|
|
|
- Method Assumes no rotated parent.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:this rotateX]( [param:Float rad] )</h3>
|
|
|
|
- <p>
|
|
|
|
- rad - the angle to rotate in radians.<br /><br />
|
|
|
|
-
|
|
|
|
- Rotates the object around x axis in local space.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
- <h3>[method:this rotateY]( [param:Float rad] )</h3>
|
|
|
|
- <p>
|
|
|
|
- rad - the angle to rotate in radians.<br /><br />
|
|
|
|
-
|
|
|
|
- Rotates the object around y axis in local space.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <p>
|
|
|
|
+ vector - 一个表示世界空间中位置的向量。<br /><br />
|
|
|
|
+ 也可以使用世界空间中[page:.x x]、[page:.y y]和[page:.z z]的位置分量。<br /><br />
|
|
|
|
+ 旋转物体使其在世界空间中面朝一个点。<br /><br />
|
|
|
|
+ 这一方法不支持其父级被旋转过或者被位移过的物体。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
|
|
|
|
+ <p>抽象(空方法),在一条被投射出的射线与这个物体之间获得交点。
|
|
|
|
+ 在一些子类,例如[page:Mesh], [page:Line], and [page:Points]实现了这个方法,以用于光线投射。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:null remove]( [param:Object3D object], ... )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 从当前对象的子级中移除<b>对象</b>。可以移除任意数量的对象。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:this rotateOnAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ axis —— 一个在局部空间中的标准化向量。<br />
|
|
|
|
+ angle —— 角度,以弧度来表示。<br /><br />
|
|
|
|
+ 在局部空间中绕着该物体的轴来旋转一个物体,假设这个轴已被标准化。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:this rotateOnWorldAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ axis -- 一个在世界空间中的标准化向量。<br />
|
|
|
|
+ angle -- 角度,以弧度来表示。<br /><br />
|
|
|
|
+
|
|
|
|
+ 在世界空间中绕着该物体的轴来旋转一个物体,假设这个轴已被标准化。
|
|
|
|
+ 方法假设该物体没有旋转过的父级。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:this rotateX]( [param:Float rad] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ rad - 将要旋转的角度(以弧度来表示)。<br /><br />
|
|
|
|
+ 绕局部空间的X轴旋转这个物体。
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:this rotateY]( [param:Float rad] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ rad - 将要旋转的角度(以弧度来表示)。<br /><br />
|
|
|
|
+ 绕局部空间的Y轴旋转这个物体。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[method:this rotateZ]( [param:Float rad] )</h3>
|
|
|
|
- <p>
|
|
|
|
- rad - the angle to rotate in radians.<br /><br />
|
|
|
|
|
|
+ <h3>[method:this rotateZ]( [param:Float rad] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ rad - 将要旋转的角度(以弧度来表示)。<br /><br />
|
|
|
|
+ 绕局部空间的Z轴旋转这个物体。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Rotates the object around z axis in local space.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:null setRotationFromAxisAngle]( [param:Vector3 axis], [param:Float angle] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ axis -- 一个在局部空间中的标准化向量。<br />
|
|
|
|
+ angle -- 角度(以弧度来表示)。<br /><br />
|
|
|
|
|
|
- <h3>[method:null setRotationFromAxisAngle]( [param:Vector3 axis], [param:Float angle] )</h3>
|
|
|
|
- <p>
|
|
|
|
- axis -- A normalized vector in object space. <br />
|
|
|
|
- angle -- angle in radians<br /><br />
|
|
|
|
|
|
+ 调用[page:.quaternion]中的[page:Quaternion.setFromAxisAngle setFromAxisAngle]( [page:Float axis], [page:Float angle] )。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Calls [page:Quaternion.setFromAxisAngle setFromAxisAngle]( [page:Float axis], [page:Float angle] )
|
|
|
|
- on the [page:.quaternion].
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:null setRotationFromEuler]( [param:Euler euler] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ euler -- 指定了旋转量的欧拉角。<br />
|
|
|
|
|
|
- <h3>[method:null setRotationFromEuler]( [param:Euler euler] )</h3>
|
|
|
|
- <p>
|
|
|
|
- euler -- Euler angle specifying rotation amount.<br />
|
|
|
|
|
|
+ 调用[page:.quaternion]中的[page:Quaternion.setRotationFromEuler setRotationFromEuler]( [page:Euler euler])。
|
|
|
|
|
|
- Calls [page:Quaternion.setRotationFromEuler setRotationFromEuler]( [page:Euler euler])
|
|
|
|
- on the [page:.quaternion].
|
|
|
|
- </p>
|
|
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[method:null setRotationFromMatrix]( [param:Matrix4 m] )</h3>
|
|
|
|
- <p>
|
|
|
|
- m -- rotate the quaternion by the rotation component of the matrix.<br />
|
|
|
|
|
|
+ <h3>[method:null setRotationFromMatrix]( [param:Matrix4 m] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ m -- 通过该矩阵中的旋转分量来旋转四元数。<br />
|
|
|
|
+
|
|
|
|
+ 调用[page:.quaternion]中的[page:Quaternion.setFromRotationMatrix setFromRotationMatrix]( [page:Matrix4 m])。
|
|
|
|
+ <br /><br />
|
|
|
|
|
|
- Calls [page:Quaternion.setFromRotationMatrix setFromRotationMatrix]( [page:Matrix4 m])
|
|
|
|
- on the [page:.quaternion].<br /><br />
|
|
|
|
|
|
+ 请注意,这里假设m上的3x3矩阵是一个纯旋转矩阵(即未缩放的矩阵)。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:null setRotationFromQuaternion]( [param:Quaternion q] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ q -- 标准化的四元数。<br /><br />
|
|
|
|
|
|
- <h3>[method:null setRotationFromQuaternion]( [param:Quaternion q] )</h3>
|
|
|
|
- <p>
|
|
|
|
- q -- normalized Quaternion.<br /><br />
|
|
|
|
|
|
+将所给的四元数复制到[page:.quaternion]中。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Copy the given quaternion into [page:.quaternion].
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:null toJSON]( [param:Quaternion q] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ 将这个对象转换为JSON格式。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[method:null toJSON]( [param:Quaternion q] )</h3>
|
|
|
|
- <p>
|
|
|
|
- Convert the object to JSON format.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:this translateOnAxis]( [param:Vector3 axis], [param:Float distance] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ axis -- 一个在局部空间中的标准化向量。<br />
|
|
|
|
+ distance -- 将要平移的距离。<br /><br />
|
|
|
|
+ 在局部空间中沿着一条轴来平移物体,假设轴已被标准化。
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[method:this translateOnAxis]( [param:Vector3 axis], [param:Float distance] )</h3>
|
|
|
|
- <p>
|
|
|
|
- axis -- A normalized vector in object space.<br />
|
|
|
|
- distance -- The distance to translate.<br /><br />
|
|
|
|
|
|
+ <h3>[method:this translateX]( [param:Float distance] )</h3>
|
|
|
|
+ <p>沿着X轴将平移*distance*个单位。</p>
|
|
|
|
|
|
- Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:this translateY]( [param:Float distance] )</h3>
|
|
|
|
+ <p>沿着Y轴将平移*distance*个单位。</p>
|
|
|
|
|
|
- <h3>[method:this translateX]( [param:Float distance] )</h3>
|
|
|
|
- <p>Translates object along x axis in object space by *distance* units.</p>
|
|
|
|
|
|
+ <h3>[method:this translateZ]( [param:Float distance] )</h3>
|
|
|
|
+ <p>沿着Z轴将平移*distance*个单位。</p>
|
|
|
|
|
|
- <h3>[method:this translateY]( [param:Float distance] )</h3>
|
|
|
|
- <p>Translates object along y axis in object space by *distance* units.</p>
|
|
|
|
|
|
+ <h3>[method:null traverse]( [param:Function callback] )</h3>
|
|
|
|
+ <p>
|
|
|
|
|
|
- <h3>[method:this translateZ]( [param:Float distance] )</h3>
|
|
|
|
- <p>Translates object along z axis in object space by *distance* units.</p>
|
|
|
|
|
|
+ callback - 以一个object3D对象作为第一个参数的函数。
|
|
|
|
+ <br /><br />
|
|
|
|
|
|
- <h3>[method:null traverse]( [param:Function callback] )</h3>
|
|
|
|
- <p>
|
|
|
|
- callback - A function with as first argument an object3D object.<br /><br />
|
|
|
|
|
|
+ 在对象以及后代中执行的回调函数。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Executes the callback on this object and all descendants.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:null traverseVisible]( [param:Function callback] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ callback - 以一个object3D对象作为第一个参数的函数。
|
|
|
|
+ <br /><br />
|
|
|
|
|
|
- <h3>[method:null traverseVisible]( [param:Function callback] )</h3>
|
|
|
|
- <p>
|
|
|
|
- callback - A function with as first argument an object3D object.<br /><br />
|
|
|
|
|
|
+ 类似traverse函数,但在这里,回调函数仅对可见的对象执行,不可见对象的后代将不遍历。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Like traverse, but the callback will only be executed for visible objects.
|
|
|
|
- Descendants of invisible objects are not traversed.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:null traverseAncestors]( [param:Function callback] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ callback - 以一个object3D对象作为第一个参数的函数。<br /><br />
|
|
|
|
|
|
- <h3>[method:null traverseAncestors]( [param:Function callback] )</h3>
|
|
|
|
- <p>
|
|
|
|
- callback - A function with as first argument an object3D object.<br /><br />
|
|
|
|
|
|
+ 在所有的祖先中执行回调函数。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Executes the callback on all ancestors.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h3>[method:null updateMatrix]()</h3>
|
|
|
|
+ <p>更新局部变换。</p>
|
|
|
|
|
|
- <h3>[method:null updateMatrix]()</h3>
|
|
|
|
- <p>Update the local transform.</p>
|
|
|
|
|
|
+ <h3>[method:null updateMatrixWorld]( [param:Boolean force] )</h3>
|
|
|
|
+ <p>更新物体及其子级的全局变换。</p>
|
|
|
|
|
|
- <h3>[method:null updateMatrixWorld]( [param:Boolean force] )</h3>
|
|
|
|
- <p>Update the global transform of the object and its children.</p>
|
|
|
|
|
|
|
|
|
|
+ <h3>[method:Vector3 worldToLocal]( [param:Vector3 vector] )</h3>
|
|
|
|
+ <p>
|
|
|
|
+ vector - 一个世界向量.<br /><br />
|
|
|
|
|
|
- <h3>[method:Vector3 worldToLocal]( [param:Vector3 vector] )</h3>
|
|
|
|
- <p>
|
|
|
|
- vector - A world vector.<br /><br />
|
|
|
|
|
|
+ 将世界空间中的向量转换为局部空间向量。
|
|
|
|
+ </p>
|
|
|
|
|
|
- Updates the vector from world space to local space.
|
|
|
|
- </p>
|
|
|
|
|
|
+ <h2>源代码</h2>
|
|
|
|
|
|
- <h2>Source</h2>
|
|
|
|
|
|
+ [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
|
|
+</body>
|
|
|
|
|
|
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
|
|
- </body>
|
|
|
|
-</html>
|
|
|
|
|
|
+</html>
|