Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
9b222612
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 搜索 >>
提交
9b222612
编写于
5月 06, 2021
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Examples: Simplified webxr_vr_handinput_profiles.
上级
571347f5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
35 deletion
+20
-35
examples/webxr_vr_handinput_profiles.html
examples/webxr_vr_handinput_profiles.html
+20
-35
未找到文件。
examples/webxr_vr_handinput_profiles.html
浏览文件 @
9b222612
...
...
@@ -26,11 +26,6 @@
let
controller1
,
controller2
;
let
controllerGrip1
,
controllerGrip2
;
const
currentHandModel
=
{
left
:
0
,
right
:
0
};
const
handModels
=
{
left
:
null
,
right
:
null
...
...
@@ -108,36 +103,28 @@
scene
.
add
(
controllerGrip1
);
hand1
=
renderer
.
xr
.
getHand
(
0
);
hand1
.
userData
.
currentHandModel
=
0
;
scene
.
add
(
hand1
);
handModels
.
left
=
[
handModelFactory
.
createHandModel
(
hand1
,
"
boxes
"
),
handModelFactory
.
createHandModel
(
hand1
,
"
spheres
"
),
// low poly option disabled until low poly hands model is fixed
// handModelFactory.createHandModel( hand1, "oculus", { model: "lowpoly" } ),
handModelFactory
.
createHandModel
(
hand1
,
"
oculus
"
)
handModelFactory
.
createHandModel
(
hand1
,
"
mesh
"
)
];
handModels
.
left
.
forEach
(
model
=>
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
model
.
visible
=
false
;
const
model
=
handModels
.
left
[
i
];
model
.
visible
=
i
==
0
;
hand1
.
add
(
model
);
}
);
handModels
.
left
[
currentHandModel
.
left
].
visible
=
true
;
function
cycleHandModel
(
hand
)
{
handModels
[
hand
][
currentHandModel
[
hand
]
].
visible
=
false
;
currentHandModel
[
hand
]
=
(
currentHandModel
[
hand
]
+
1
)
%
handModels
[
hand
].
length
;
handModels
[
hand
][
currentHandModel
[
hand
]
].
visible
=
true
;
}
hand1
.
addEventListener
(
'
pinchend
'
,
evt
=>
{
hand1
.
addEventListener
(
'
pinchend
'
,
function
(
event
)
{
cycleHandModel
(
evt
.
handedness
);
handModels
.
left
[
this
.
userData
.
currentHandModel
].
visible
=
false
;
this
.
userData
.
currentHandModel
=
(
this
.
userData
.
currentHandModel
+
1
)
%
3
;
handModels
.
left
[
this
.
userData
.
currentHandModel
].
visible
=
true
;
}
);
...
...
@@ -148,34 +135,32 @@
scene
.
add
(
controllerGrip2
);
hand2
=
renderer
.
xr
.
getHand
(
1
);
hand2
.
userData
.
currentHandModel
=
0
;
scene
.
add
(
hand2
);
handModels
.
right
=
[
handModelFactory
.
createHandModel
(
hand2
,
"
boxes
"
),
handModelFactory
.
createHandModel
(
hand2
,
"
spheres
"
),
// low poly option disabled until low poly hands model is fixed
// handModelFactory.createHandModel( hand2, "oculus", { model: "lowpoly" } ),
handModelFactory
.
createHandModel
(
hand2
,
"
oculus
"
)
handModelFactory
.
createHandModel
(
hand2
,
"
mesh
"
)
];
handModels
.
right
.
forEach
(
model
=>
{
model
.
visible
=
false
;
hand2
.
add
(
model
);
}
);
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
handModels
.
right
[
currentHandModel
.
right
].
visible
=
true
;
const
model
=
handModels
.
right
[
i
];
model
.
visible
=
i
==
0
;
hand2
.
add
(
model
);
window
.
handModels
=
handModels
;
}
hand2
.
addEventListener
(
'
pinchend
'
,
evt
=>
{
hand2
.
addEventListener
(
'
pinchend
'
,
function
(
evevent
)
{
cycleHandModel
(
evt
.
handedness
);
handModels
.
right
[
this
.
userData
.
currentHandModel
].
visible
=
false
;
this
.
userData
.
currentHandModel
=
(
this
.
userData
.
currentHandModel
+
1
)
%
3
;
handModels
.
right
[
this
.
userData
.
currentHandModel
].
visible
=
true
;
}
);
//
window
.
hands
=
[
hand1
,
hand2
];
const
geometry
=
new
THREE
.
BufferGeometry
().
setFromPoints
(
[
new
THREE
.
Vector3
(
0
,
0
,
0
),
new
THREE
.
Vector3
(
0
,
0
,
-
1
)
]
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录