Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
3faa6b62
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,发现更多精彩内容 >>
提交
3faa6b62
编写于
1月 15, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'RommelVR/master' into dev
上级
675d9f2a
8c53e156
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
35 deletion
+18
-35
examples/js/controls/FirstPersonControls.js
examples/js/controls/FirstPersonControls.js
+18
-35
未找到文件。
examples/js/controls/FirstPersonControls.js
浏览文件 @
3faa6b62
...
...
@@ -187,59 +187,42 @@ THREE.FirstPersonControls = function ( object, domElement ) {
};
this
.
update
=
function
(
delta
)
{
var
actualMoveSpeed
=
0
;
if
(
this
.
freeze
)
{
return
;
}
else
{
if
(
this
.
heightSpeed
)
{
var
y
=
THREE
.
Math
.
clamp
(
this
.
object
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
);
var
heightDelta
=
y
-
this
.
heightMin
;
this
.
autoSpeedFactor
=
delta
*
(
heightDelta
*
this
.
heightCoef
);
}
else
{
this
.
autoSpeedFactor
=
0.0
;
}
}
if
(
this
.
heightSpeed
)
{
actualMoveSpeed
=
delta
*
this
.
movementSpeed
;
var
y
=
THREE
.
Math
.
clamp
(
this
.
object
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
);
var
heightDelta
=
y
-
this
.
heightMin
;
if
(
this
.
moveForward
||
(
this
.
autoForward
&&
!
this
.
moveBackward
)
)
this
.
object
.
translateZ
(
-
(
actualMoveSpeed
+
this
.
autoSpeedFactor
)
);
if
(
this
.
moveBackward
)
this
.
object
.
translateZ
(
actualMoveSpeed
);
this
.
autoSpeedFactor
=
delta
*
(
heightDelta
*
this
.
heightCoef
);
if
(
this
.
moveLeft
)
this
.
object
.
translateX
(
-
actualMoveSpeed
);
if
(
this
.
moveRight
)
this
.
object
.
translateX
(
actualMoveSpeed
);
}
else
{
if
(
this
.
moveUp
)
this
.
object
.
translateY
(
actualMoveSpeed
);
if
(
this
.
moveDown
)
this
.
object
.
translateY
(
-
actualMoveSpeed
);
this
.
autoSpeedFactor
=
0.0
;
var
actualLookSpeed
=
delta
*
this
.
lookSpeed
;
}
if
(
!
this
.
activeLook
)
{
var
actualMoveSpeed
=
delta
*
this
.
movementSpeed
;
actualLookSpeed
=
0
;
if
(
this
.
moveForward
||
(
this
.
autoForward
&&
!
this
.
moveBackward
)
)
this
.
object
.
translateZ
(
-
(
actualMoveSpeed
+
this
.
autoSpeedFactor
)
);
if
(
this
.
moveBackward
)
this
.
object
.
translateZ
(
actualMoveSpeed
);
}
if
(
this
.
moveLeft
)
this
.
object
.
translateX
(
-
actualMoveSpeed
);
if
(
this
.
moveRight
)
this
.
object
.
translateX
(
actualMoveSpeed
);
this
.
lon
+=
this
.
mouseX
*
actualLookSpeed
;
if
(
this
.
lookVertical
)
this
.
lat
-=
this
.
mouseY
*
actualLookSpeed
;
// * this.invertVertical?-1:1
;
if
(
this
.
moveUp
)
this
.
object
.
translateY
(
actualMoveSpeed
)
;
if
(
this
.
moveDown
)
this
.
object
.
translateY
(
-
actualMoveSpeed
)
;
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
)
);
this
.
phi
=
THREE
.
Math
.
degToRad
(
90
-
this
.
lat
);
this
.
theta
=
THREE
.
Math
.
degToRad
(
this
.
lon
);
var
actualLookSpeed
=
delta
*
this
.
lookSpeed
;
var
targetPosition
=
this
.
target
,
position
=
this
.
object
.
position
;
if
(
!
this
.
activeLook
)
{
targetPosition
.
x
=
position
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
targetPosition
.
y
=
position
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
targetPosition
.
z
=
position
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
actualLookSpeed
=
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录