Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
a72aa824
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,发现更多精彩内容 >>
提交
a72aa824
编写于
3月 22, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Scaled phong.app.json down.
上级
d1355dbb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
34 deletion
+54
-34
editor/examples/pong.app.json
editor/examples/pong.app.json
+54
-34
未找到文件。
editor/examples/pong.app.json
浏览文件 @
a72aa824
{
"metadata"
:
{
"type"
:
"App"
},
"project"
:
{
"shadows"
:
false
,
"editable"
:
false
,
"vr"
:
false
},
"camera"
:
{
"metadata"
:
{
"version"
:
4.
3
,
"version"
:
4.
4
,
"type"
:
"Object"
,
"generator"
:
"Object
Exporter
"
"generator"
:
"Object
3D.toJSON
"
},
"object"
:
{
"uuid"
:
"
8EFB9C06-6312-4975-B04A-C9E4549BE348
"
,
"uuid"
:
"
B901700E-2B1B-4D74-9201-164193F8304E
"
,
"type"
:
"PerspectiveCamera"
,
"name"
:
"Camera"
,
"matrix"
:
[
0.9522120356559753
,
4.608077919243669e-9
,
-0.3054378032684326
,
0
,
-0.17742955684661865
,
0.8139732480049133
,
-0.553142249584198
,
0
,
0.24861818552017212
,
0.5809023976325989
,
0.7750750780105591
,
0
,
18.645999908447266
,
43.56800079345703
,
58.13100051879883
,
1
],
"focalLength"
:
10
,
"zoom"
:
1
,
"fov"
:
50
,
"aspect"
:
1.32
91139240506329
,
"aspect"
:
1.32
17270194986073
,
"near"
:
0.1
,
"far"
:
100000
,
"matrix"
:
[
0.9522120356559753
,
4.209433246415983e-9
,
-0.3054378032684326
,
0
,
-0.17742955684661865
,
0.8139731884002686
,
-0.553142249584198
,
0
,
0.24861818552017212
,
0.5809023976325989
,
0.7750750780105591
,
0
,
186.46363830566406
,
435.67681884765625
,
581.3063354492188
,
1
]
"far"
:
100000
}
},
"scene"
:
{
"metadata"
:
{
"version"
:
4.
3
,
"version"
:
4.
4
,
"type"
:
"Object"
,
"generator"
:
"Object
Exporter
"
"generator"
:
"Object
3D.toJSON
"
},
"geometries"
:
[
{
"uuid"
:
"7
7B20ED1-2871-4B14-A652-8F823B2A817E
"
,
"uuid"
:
"7
13F75F5-5D04-4069-89CB-2035F5619AC3
"
,
"type"
:
"PlaneGeometry"
,
"width"
:
60
0
,
"height"
:
40
0
,
"width"
:
60
,
"height"
:
40
,
"widthSegments"
:
1
,
"heightSegments"
:
1
},
{
"uuid"
:
"
7ADE0D01-A56A-4D33-869A-6C360E096EF7
"
,
"uuid"
:
"
4537EA66-3CD6-43A1-97A9-EB59F3258BF9
"
,
"type"
:
"BoxGeometry"
,
"width"
:
10
,
"height"
:
10
,
"width"
:
1
,
"height"
:
1
,
"depth"
:
1
,
"widthSegments"
:
1
,
"heightSegments"
:
1
,
"depthSegments"
:
1
},
{
"uuid"
:
"3C546CA4-FF0F-4BA1-9406-0CD0D560A396"
,
"type"
:
"BoxGeometry"
,
"width"
:
2
,
"height"
:
2
,
"depth"
:
10
,
"widthSegments"
:
1
,
"heightSegments"
:
1
,
"depthSegments"
:
1
},
{
"uuid"
:
"
E8C064B6-3454-4739-9E02-3B07B8E70B4
C"
,
"uuid"
:
"
4628F4A7-D572-45C2-9A67-807D71FF19E
C"
,
"type"
:
"BoxGeometry"
,
"width"
:
2
0
,
"height"
:
2
0
,
"depth"
:
10
0
,
"width"
:
2
,
"height"
:
2
,
"depth"
:
10
,
"widthSegments"
:
1
,
"heightSegments"
:
1
,
"depthSegments"
:
1
...
...
@@ -86,41 +106,41 @@
"uuid"
:
"B47D0BFC-D63A-4CBB-985E-9C4DBDF086E4"
,
"type"
:
"Mesh"
,
"name"
:
"Ground"
,
"
geometry"
:
"77B20ED1-2871-4B14-A652-8F823B2A817E"
,
"
material"
:
"7EDF7C08-6325-418A-BBAB-89341C694730
"
,
"mat
rix"
:
[
1
,
0
,
0
,
0
,
0
,
0.0007960614748299122
,
-0.9999997019767761
,
0
,
0
,
0.9999997019767761
,
0.0007960614748299122
,
0
,
0
,
-10
,
0
,
1
]
"
matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.0007960238144733012
,
-0.9999997019767761
,
0
,
0
,
0.9999997019767761
,
0.0007960238144733012
,
0
,
0
,
-1
,
0
,
1
]
,
"
geometry"
:
"713F75F5-5D04-4069-89CB-2035F5619AC3
"
,
"mat
erial"
:
"7EDF7C08-6325-418A-BBAB-89341C694730"
},
{
"uuid"
:
"CE13E58A-4E8B-4F72-9E2E-7DE57C58F989"
,
"type"
:
"Mesh"
,
"name"
:
"Ball"
,
"
geometry"
:
"7ADE0D01-A56A-4D33-869A-6C360E096EF7"
,
"
material"
:
"B1CAF098-FE36-45E1-BEBE-8D6AC04821CC
"
,
"mat
rix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
]
"
matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
]
,
"
geometry"
:
"4537EA66-3CD6-43A1-97A9-EB59F3258BF9
"
,
"mat
erial"
:
"B1CAF098-FE36-45E1-BEBE-8D6AC04821CC"
},
{
"uuid"
:
"2AAEA3AA-EC45-492B-B450-10473D1EC6C5"
,
"type"
:
"Mesh"
,
"name"
:
"Pad 1"
,
"
geometry"
:
"E8C064B6-3454-4739-9E02-3B07B8E70B4C"
,
"
material"
:
"FBDBE66D-B613-4741-802D-5AE1DE07DE4
6"
,
"mat
rix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-240
,
0
,
0
,
1
]
"
matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-24
,
0
,
0
,
1
]
,
"
geometry"
:
"3C546CA4-FF0F-4BA1-9406-0CD0D560A39
6"
,
"mat
erial"
:
"FBDBE66D-B613-4741-802D-5AE1DE07DE46"
},
{
"uuid"
:
"F1DD46A7-6584-4A37-BC76-852C3911077E"
,
"type"
:
"Mesh"
,
"name"
:
"Pad 2"
,
"
geometry"
:
"E8C064B6-3454-4739-9E02-3B07B8E70B4C"
,
"
material"
:
"FBDBE66D-B613-4741-802D-5AE1DE07DE46
"
,
"mat
rix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
240
,
0
,
0
,
1
]
"
matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
24
,
0
,
0
,
1
]
,
"
geometry"
:
"4628F4A7-D572-45C2-9A67-807D71FF19EC
"
,
"mat
erial"
:
"FBDBE66D-B613-4741-802D-5AE1DE07DE46"
},
{
"uuid"
:
"C62AAE9F-9E51-46A5-BD2B-71BA804FC0B3"
,
"type"
:
"DirectionalLight"
,
"name"
:
"DirectionalLight 3"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
10
,
20
,
15
,
1
],
"color"
:
16777215
,
"intensity"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
100
,
200
,
150
,
1
]
"intensity"
:
1
}]
}
},
...
...
@@ -128,7 +148,7 @@
"31517222-A9A7-4EAF-B5F6-60751C0BABA3"
:
[
{
"name"
:
"Game logic"
,
"source"
:
"var ball = this.getObjectByName( 'Ball' );
\n\n
var position = ball.position;
\n\n
var velocity = new THREE.Vector3();
\n\n
var direction = new THREE.Vector3();
\n
direction.x = Math.random() - 0.5;
\n
direction.z = Math.random() - 0.5;
\n
direction.normalize();
\n\n
var pad1 = this.getObjectByName( 'Pad 1' );
\n
var pad2 = this.getObjectByName( 'Pad 2' );
\n\n
var raycaster = new THREE.Raycaster();
\n
var objects = [ pad1, pad2 ];
\n\n
//
\n\n
function mousemove( event ) {
\n\n\t
pad1.position.z = ( event.clientX / player.width ) * 30
0 - 150;
\n\t
pad2.position.z = - pad1.position.z;
\n\n
}
\n\n
function update( event ) {
\n\t\n\t
if ( position.x < -300 || position.x > 300 ) direction.x = - direction.x;
\n\t
if ( position.z < -200 || position.z > 200 ) direction.z = - direction.z;
\n\t\n\t
position.x = Math.max( - 300, Math.min( 300, position.x ) );
\n\t
position.z = Math.max( - 200, Math.min( 200, position.z ) );
\n\t\n\t
raycaster.set( position, direction );
\n\t\n\t
var intersections = raycaster.intersectObjects( objects );
\n\t\n\t
if ( intersections.length > 0 ) {
\n\n\t\t
var intersection = intersections[ 0 ];
\n\t\t\n\t\t
if ( intersection.distance < 10 ) {
\n\t\t\t\n\t\t\t
direction.reflect( intersection.face.normal );
\n\t\t\t\n\t\t
}
\n\t\t\n\t
}
\n\n\t
position.add( velocity.copy( direction ).multiplyScalar( event.delta / 2
) );
\n\n
}"
"source"
:
"var ball = this.getObjectByName( 'Ball' );
\n\n
var position = ball.position;
\n\n
var velocity = new THREE.Vector3();
\n\n
var direction = new THREE.Vector3();
\n
direction.x = Math.random() - 0.5;
\n
direction.z = Math.random() - 0.5;
\n
direction.normalize();
\n\n
var pad1 = this.getObjectByName( 'Pad 1' );
\n
var pad2 = this.getObjectByName( 'Pad 2' );
\n\n
var raycaster = new THREE.Raycaster();
\n
var objects = [ pad1, pad2 ];
\n\n
//
\n\n
function mousemove( event ) {
\n\n\t
pad1.position.z = ( event.clientX / player.width ) * 30
- 15;
\n\t
pad2.position.z = - pad1.position.z;
\n\n
}
\n\n
function update( event ) {
\n\t\n\t
if ( position.x < -30 || position.x > 30 ) direction.x = - direction.x;
\n\t
if ( position.z < -20 || position.z > 20 ) direction.z = - direction.z;
\n\t\n\t
position.x = Math.max( - 30, Math.min( 30, position.x ) );
\n\t
position.z = Math.max( - 20, Math.min( 20, position.z ) );
\n\t\n\t
raycaster.set( position, direction );
\n\t\n\t
var intersections = raycaster.intersectObjects( objects );
\n\t\n\t
if ( intersections.length > 0 ) {
\n\n\t\t
var intersection = intersections[ 0 ];
\n\t\t\n\t\t
if ( intersection.distance < 1 ) {
\n\t\t\t\n\t\t\t
direction.reflect( intersection.face.normal );
\n\t\t\t\n\t\t
}
\n\t\t\n\t
}
\n\n\t
position.add( velocity.copy( direction ).multiplyScalar( event.delta / 20
) );
\n\n
}"
}]
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录