Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
2f91246b
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,体验更适合开发者的 AI 搜索 >>
提交
2f91246b
编写于
5月 22, 2019
作者:
W
WestLangley
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Object3D: added attach() method
上级
93abecee
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
0 deletion
+40
-0
docs/api/en/core/Object3D.html
docs/api/en/core/Object3D.html
+3
-0
src/core/Object3D.d.ts
src/core/Object3D.d.ts
+5
-0
src/core/Object3D.js
src/core/Object3D.js
+32
-0
未找到文件。
docs/api/en/core/Object3D.html
浏览文件 @
2f91246b
...
...
@@ -217,6 +217,9 @@
<h3>
[method:this applyQuaternion]( [param:Quaternion quaternion] )
</h3>
<p>
Applies the rotation represented by the quaternion to the object.
</p>
<h3>
[method:this attach]( [param:Object3D object] )
</h3>
<p>
Adds *object* as a child of this, while maintaining the object's world transform.
</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
/>
...
...
src/core/Object3D.d.ts
浏览文件 @
2f91246b
...
...
@@ -287,6 +287,11 @@ export class Object3D extends EventDispatcher {
*/
remove
(...
object
:
Object3D
[]):
this
;
/**
* Adds object as a child of this, while maintaining the object's world transform.
*/
attach
(
object
:
Object3D
):
this
;
/**
* Searches through the object's children and returns the first with a matching id.
* @param id Unique number of the object instance
...
...
src/core/Object3D.js
浏览文件 @
2f91246b
...
...
@@ -433,6 +433,38 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
},
attach
:
function
()
{
// adds object as a child of this, while maintaining the object's world transform
var
m
=
new
Matrix4
();
return
function
attach
(
object
)
{
this
.
updateWorldMatrix
(
true
,
false
);
m
.
getInverse
(
this
.
matrixWorld
);
if
(
object
.
parent
!==
null
)
{
object
.
parent
.
updateWorldMatrix
(
true
,
false
);
m
.
multiply
(
object
.
parent
.
matrixWorld
);
}
object
.
applyMatrix
(
m
);
object
.
updateWorldMatrix
(
false
,
false
);
this
.
add
(
object
);
return
this
;
};
}(),
getObjectById
:
function
(
id
)
{
return
this
.
getObjectByProperty
(
'
id
'
,
id
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录