Skip to content
On this page

firstPersonCameraControl

FirstPersonCameraControl

Kind: global class

new FirstPersonCameraControl(opts)

第一人称控制(带碰撞检测)

ParamTypeDescription
optsobject参数
opts.viewerViewer场景类
opts.isOctreeboolean是否开启八叉树碰撞,默认射线检测(大场景亦可)。八叉树(碰撞较为流畅,超过 4 万面场景建立八叉树会有卡顿崩溃问题,目前适用于小场景)
opts.collidersArray碰撞对象
opts.moveSpeednumber移动速度
opts.speedUpnumber加速度(同时按 shift 后的速度倍数)
opts.lookSpeednumber转向速度
opts.distancenumber前后碰撞的距离
opts.personHeightnumber人的高度

firstPersonCameraControl.colliders

Kind: instance property of FirstPersonCameraControl

ParamTypeDescription
collidersobjectset objects for collision detection

firstPersonCameraControl.enabled

Kind: instance property of FirstPersonCameraControl

ParamTypeDescription
isEnabledbooleanset if this camera control is enabled

firstPersonCameraControl.enabled

Kind: instance property of FirstPersonCameraControl
Description:: getter if current camera control is enabled.

firstPersonCameraControl.rotateX(value)

Kind: instance method of FirstPersonCameraControl
Description:: rotate camera by left/right
Return:: null

ParamType
valuenumber

firstPersonCameraControl.rotateY(value)

Kind: instance method of FirstPersonCameraControl
Description:: rotate camera by up/down
Return:: null

ParamType
valuenumber

firstPersonCameraControl.update()

Kind: instance method of FirstPersonCameraControl
Description:: update current calcuate each frame.