Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
4ce5ba20
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4ce5ba20
编写于
2月 20, 2020
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Raycaster: Use THREE.Layers in intersectObject().
上级
b03e2af7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
5 deletion
+41
-5
docs/api/en/core/Object3D.html
docs/api/en/core/Object3D.html
+2
-1
docs/api/en/core/Raycaster.html
docs/api/en/core/Raycaster.html
+12
-0
docs/api/zh/core/Object3D.html
docs/api/zh/core/Object3D.html
+3
-2
docs/api/zh/core/Raycaster.html
docs/api/zh/core/Raycaster.html
+12
-0
src/core/Raycaster.d.ts
src/core/Raycaster.d.ts
+6
-0
src/core/Raycaster.js
src/core/Raycaster.js
+6
-2
未找到文件。
docs/api/en/core/Object3D.html
浏览文件 @
4ce5ba20
...
...
@@ -61,7 +61,8 @@
<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.
layer in common with the [page:Camera] in use. This property can also be used to filter out
unwanted objects in ray-intersection tests when using [page:Raycaster].
</p>
<h3>
[property:Matrix4 matrix]
</h3>
...
...
docs/api/en/core/Raycaster.html
浏览文件 @
4ce5ba20
...
...
@@ -107,6 +107,18 @@
Defaults to null.
</p>
<h3>
[property:Layers layers]
</h3>
<p>
Used by [name] to selectively ignore 3D objects when performing intersection tests. The following code example ensures that
only 3D objects on layer *1* will be honored by the instance of [name].
<code>
raycaster.layers.set( 1 );
object.layers.enable( 1 );
</code>
</p>
<h3>
[property:Object params]
</h3>
<p>
An object with the following properties:
...
...
docs/api/zh/core/Object3D.html
浏览文件 @
4ce5ba20
...
...
@@ -59,7 +59,8 @@
<h3>
[property:Layers layers]
</h3>
<p>
物体的层级关系。
物体只有和一个正在使用的[page:Camera]至少在同一个层时才可见。
物体只有和一个正在使用的[page:Camera]至少在同一个层时才可见。This property can also be used to filter out
unwanted objects in ray-intersection tests when using [page:Raycaster].
</p>
<h3>
[property:Matrix4 matrix]
</h3>
...
...
@@ -199,7 +200,7 @@
<h3>
[method:Object3D applyQuaternion]( [param:Quaternion quaternion] )
</h3>
<p>
对当前物体应用由四元数所表示的变换。
</p>
<h3>
[method:this attach]( [param:Object3D object] )
</h3>
<p>
将*object*作为子级来添加到该对象中,同时保持该object的世界变换。
</p>
...
...
docs/api/zh/core/Raycaster.html
浏览文件 @
4ce5ba20
...
...
@@ -105,6 +105,18 @@
Defaults to null.
</p>
<h3>
[property:Layers layers]
</h3>
<p>
Used by [name] to selectively ignore 3D objects when performing intersection tests. The following code example ensures that
only 3D objects on layer *1* will be honored by the instance of [name].
<code>
raycaster.layers.set( 1 );
object.layers.enable( 1 );
</code>
</p>
<h3>
[property:Object params]
</h3>
<p>
具有以下属性的对象:
<code>
...
...
src/core/Raycaster.d.ts
浏览文件 @
4ce5ba20
...
...
@@ -4,6 +4,7 @@ import { Object3D } from './Object3D';
import
{
Vector2
}
from
'
./../math/Vector2
'
;
import
{
Ray
}
from
'
./../math/Ray
'
;
import
{
Camera
}
from
'
./../cameras/Camera
'
;
import
{
Layers
}
from
'
./Layers
'
;
export
interface
Intersection
{
distance
:
number
;
...
...
@@ -62,6 +63,11 @@ export class Raycaster {
*/
camera
:
Camera
;
/**
* Used by Raycaster to selectively ignore 3D objects when performing intersection tests.
*/
layers
:
Layers
;
params
:
RaycasterParameters
;
/**
...
...
src/core/Raycaster.js
浏览文件 @
4ce5ba20
import
{
Ray
}
from
'
../math/Ray.js
'
;
import
{
Layers
}
from
'
./Layers.js
'
;
/**
* @author mrdoob / http://mrdoob.com/
...
...
@@ -14,6 +15,7 @@ function Raycaster( origin, direction, near, far ) {
this
.
near
=
near
||
0
;
this
.
far
=
far
||
Infinity
;
this
.
camera
=
null
;
this
.
layers
=
new
Layers
();
this
.
params
=
{
Mesh
:
{},
...
...
@@ -44,9 +46,11 @@ function ascSort( a, b ) {
function
intersectObject
(
object
,
raycaster
,
intersects
,
recursive
)
{
if
(
object
.
visible
===
false
)
return
;
if
(
object
.
layers
.
test
(
raycaster
.
layers
)
)
{
object
.
raycast
(
raycaster
,
intersects
);
object
.
raycast
(
raycaster
,
intersects
);
}
if
(
recursive
===
true
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录