FlyControlComponent()

new FlyControlComponent()

第一人称/第三人称飞行控制器组件构造函数

Methods

enableChangeDirecetionByMouseMove(enable)

设置是否可以通过鼠标移动改变方向
Parameters:
Name Type Description
enable boolean 设置是否可以通过鼠标移动改变方向

enableLockPointerByMouseDown(enable)

设置是否可以通过鼠标按下锁定指针,仅在指针锁定模式下有效
Parameters:
Name Type Description
enable boolean 设置是否可以通过鼠标按下锁定指针

getHotKey(type) → {THING.CodeType}

获取热键
Parameters:
Name Type Description
type THING.FlyControlKeyType 键类型;表示该键的用途
Returns:
THING.CodeType - 键码;表示键盘上的实际按键

getPickedObject() → {object}

获取当前被拾取的对象
Returns:
object - 返回被focusUI拾取的对象

setAttachCamera(attachCamera, cameraNear)

设置附加相机
Parameters:
Name Type Default Description
attachCamera Thing.Camera 附加的相机
cameraNear number 0.1 附加相机的近平面距离

setClearInteractWhenFocusOut(clear)

设置当失去3D窗口焦点时是否清除交互效果目前效果包括移动和转向,但不包括重力
Parameters:
Name Type Description
clear boolean true表示当失去3D窗口焦点时清除交互效果

setEyeHeight(height)

设置相机高度
Parameters:
Name Type Description
height number 相机高于地板的高度

setFloorObject(floorobj)

设置地板对象
Parameters:
Name Type Description
floorobj object 我们必须站立的地板

setFocusUI(focus_ui)

设置焦点UI
Parameters:
Name Type Description
focus_ui HTMLElement 焦点UI的div元素

setHotKey(type, code)

设置热键
Parameters:
Name Type Description
type THING.FlyControlKeyType 键类型;表示该键的用途
code THING.CodeType 键码;表示键盘上的实际按键

setInteractActionName(type, actionName)

设置交互动作名称
Parameters:
Name Type Description
type string 交互类型,可能是InteractType中的一个元素
actionName string 交互动作名称

setInteractActionSpeed(type, actionSpeed)

设置交互动作速度
Parameters:
Name Type Description
type string 交互类型,可能是InteractType中的一个元素
actionSpeed number 交互动作动画速度

setInteractSpeed(type, speed)

设置交互速度
Parameters:
Name Type Description
type string 交互类型,可能是InteractType中的一个元素 但只有walk\run\jump\fly\flyup\flydown有意义
speed number 交互速度,如行走速度

setMaxPitch(pitch)

设置最大俯仰角
Parameters:
Name Type Description
pitch number 最大俯仰角值

setMinPitch(pitch)

设置最小俯仰角
Parameters:
Name Type Description
pitch number 最小俯仰角值

setPlayerTurning(turning)

设置玩家转向
Parameters:
Name Type Description
turning number 玩家Y轴转向角度

setPointerLockEnable(enable)

设置指针锁定模式是否启用
Parameters:
Name Type Description
enable boolean 是否启用指针锁定模式

setThirdPersonCameraDis(dis)

设置对象和相机之间的距离
Parameters:
Name Type Description
dis number 第三人称视角下对象和相机之间的距离

setUseLocalUp(use)

设置是否使用对象的up向量
Parameters:
Name Type Description
use boolean 是否使用对象的up向量