Skip to content

@simversus/yjvisDocs


@simversus/yjvis / PointerLockControl

Class: PointerLockControl

相机控制器基类

Extends

Constructors

new PointerLockControl()

new PointerLockControl(scene, dom): PointerLockControl

Parameters

scene: Scene

dom: HTMLElement = document.body

Returns

PointerLockControl

Overrides

CameraControlBase.constructor

Defined in

control/pointerLockControl.ts:26

Properties

_gesture

protected _gesture: Required<Partial<object>>

Inherited from

CameraControlBase._gesture

Defined in

control/CameraControlBase.ts:103


_interractorUbinds

protected _interractorUbinds: Function[]

Inherited from

CameraControlBase._interractorUbinds

Defined in

control/controlBase.ts:22


_isDragging

protected _isDragging: boolean

是否在拖动

Inherited from

CameraControlBase._isDragging

Defined in

control/controlBase.ts:21


_lastPostion

protected _lastPostion: Vec3

Inherited from

CameraControlBase._lastPostion

Defined in

control/CameraControlBase.ts:100


_lastTargetPosition

protected _lastTargetPosition: Vec3

Inherited from

CameraControlBase._lastTargetPosition

Defined in

control/CameraControlBase.ts:101


_needUpdate

protected _needUpdate: boolean = false

Inherited from

CameraControlBase._needUpdate

Defined in

control/CameraControlBase.ts:102


_originCameraControlEnabled

protected _originCameraControlEnabled: boolean

相机控制器的初始启用状态

Inherited from

CameraControlBase._originCameraControlEnabled

Defined in

control/controlBase.ts:17


children

children: Node[] = []

子节点

Inherited from

CameraControlBase.children

Defined in

scene/Node.ts:44


classHierarchy

classHierarchy: ClassEnum[]

Deprecated

Inherited from

CameraControlBase.classHierarchy

Defined in

core/baseObject.ts:96


dom

dom: HTMLElement = document.body

Defined in

control/pointerLockControl.ts:28


ease

ease: number = 0.25

缓动系数,值越小越慢越平滑

Inherited from

CameraControlBase.ease

Defined in

control/CameraControlBase.ts:68


enablePan

enablePan: boolean = true

是否允许缩放

Inherited from

CameraControlBase.enablePan

Defined in

control/CameraControlBase.ts:52


enableRotate

enableRotate: boolean = true

是否允许旋转

Inherited from

CameraControlBase.enableRotate

Defined in

control/CameraControlBase.ts:44


enableZoom

enableZoom: boolean = true

是否允许缩放

Inherited from

CameraControlBase.enableZoom

Defined in

control/CameraControlBase.ts:48


enabled

enabled: boolean = true

是否启用

Inherited from

CameraControlBase.enabled

Defined in

control/controlBase.ts:13


eventButtons

eventButtons: Record<PointerLockControlEvent, InteractorButton>

Defined in

control/pointerLockControl.ts:20


inertia

inertia: number = 0.85

惯性系数,值越小惯性越小

Inherited from

CameraControlBase.inertia

Defined in

control/CameraControlBase.ts:72


isPanning

isPanning: boolean = false

Internal

是否在拖放中

Inherited from

CameraControlBase.isPanning

Defined in

control/CameraControlBase.ts:98


isRotating

isRotating: boolean = false

Internal

是否在旋转中,用于lod

Inherited from

CameraControlBase.isRotating

Defined in

control/CameraControlBase.ts:93


label

label: string

自定义标识

Inherited from

CameraControlBase.label

Defined in

core/baseObject.ts:104


layerMask

layerMask: number = 0

层级

Inherited from

CameraControlBase.layerMask

Defined in

scene/Node.ts:93


matrix

matrix: Mat4

本地矩阵

Inherited from

CameraControlBase.matrix

Defined in

scene/Node.ts:53


maxDistance

maxDistance: number = Infinity

最大缩放距离

Inherited from

CameraControlBase.maxDistance

Defined in

control/CameraControlBase.ts:80


maxPolarAngle

maxPolarAngle: number = Math.PI

Defined in

control/pointerLockControl.ts:24


maxZoom

maxZoom: number = Infinity

最大zoom

Inherited from

CameraControlBase.maxZoom

Defined in

control/CameraControlBase.ts:88


minDistance

minDistance: number = 0.0001

最小缩放距离

Inherited from

CameraControlBase.minDistance

Defined in

control/CameraControlBase.ts:76


minPolarAngle

minPolarAngle: number = 0

Defined in

control/pointerLockControl.ts:22


minZoom

minZoom: number = 0.0001

最小zoom

Inherited from

CameraControlBase.minZoom

Defined in

control/CameraControlBase.ts:84


moveSpeed

moveSpeed: number = 1

Defined in

control/pointerLockControl.ts:18


onAfterRender()

onAfterRender: (node) => void

渲染后的回调

Parameters

node: Node

Returns

void

Inherited from

CameraControlBase.onAfterRender

Defined in

scene/Node.ts:89


onBeforeRender()

onBeforeRender: (node) => void

渲染前的回调

Parameters

node: Node

Returns

void

Inherited from

CameraControlBase.onBeforeRender

Defined in

scene/Node.ts:85


panSpeed

panSpeed: number = 1

拖动速度

Inherited from

CameraControlBase.panSpeed

Defined in

control/CameraControlBase.ts:64


parent?

optional parent: Node

父节点

Inherited from

CameraControlBase.parent

Defined in

scene/Node.ts:49


position

position: Vec3

位置

Inherited from

CameraControlBase.position

Defined in

scene/Node.ts:67


quaternion

quaternion: Quat

旋转

Inherited from

CameraControlBase.quaternion

Defined in

scene/Node.ts:77


rotateSpeed

rotateSpeed: number = 1

旋转速度

Inherited from

CameraControlBase.rotateSpeed

Defined in

control/CameraControlBase.ts:56


scaling

scaling: Vec3

缩放

Inherited from

CameraControlBase.scaling

Defined in

scene/Node.ts:72


scene

scene: Scene

Inherited from

CameraControlBase.scene

Defined in

control/controlBase.ts:50


target

target: Vec3

相机焦点/旋转中心点

Inherited from

CameraControlBase.target

Defined in

control/CameraControlBase.ts:40


up

up: Vec3

上方向

Inherited from

CameraControlBase.up

Defined in

scene/Node.ts:62


userData

userData: any

用户自定义数据

Inherited from

CameraControlBase.userData

Defined in

core/baseObject.ts:100


uuid

uuid: number

唯一标识符

Inherited from

CameraControlBase.uuid

Defined in

core/baseObject.ts:92


visible

visible: boolean = true

是否可见

Inherited from

CameraControlBase.visible

Defined in

scene/Node.ts:39


worldMatrix

worldMatrix: Mat4

世界矩阵

Inherited from

CameraControlBase.worldMatrix

Defined in

scene/Node.ts:57


zoomSpeed

zoomSpeed: number = 1

缩放速度

Inherited from

CameraControlBase.zoomSpeed

Defined in

control/CameraControlBase.ts:60

Accessors

_canUpdate

get protected _canUpdate(): boolean

Returns

boolean

Inherited from

CameraControlBase._canUpdate

Defined in

control/controlBase.ts:46


camera

get protected camera(): Camera

Returns

Camera

Inherited from

CameraControlBase.camera

Defined in

control/controlBase.ts:40


interactor

get protected interactor(): Interactor

Returns

Interactor

Inherited from

CameraControlBase.interactor

Defined in

control/controlBase.ts:43


mtime

get mtime(): number

Returns

number

Inherited from

CameraControlBase.mtime

Defined in

core/baseObject.ts:118


object

get object(): Node

控制的对象

set object(node): void

设置控制对象

Parameters

node: Node

Returns

Node

Inherited from

CameraControlBase.object

Defined in

control/controlBase.ts:30

Methods

_addHandlers()

protected _addHandlers(): void

Internal

添加事件监听

Returns

void

Overrides

CameraControlBase._addHandlers

Defined in

control/pointerLockControl.ts:56


_onFrame()

protected _onFrame(): void

Internal

每一帧的回调

Returns

void

Overrides

CameraControlBase._onFrame

Defined in

control/pointerLockControl.ts:44


_removeHandlers()

protected _removeHandlers(): void

Returns

void

Inherited from

CameraControlBase._removeHandlers

Defined in

control/controlBase.ts:73


_render()

protected _render(): void

Returns

void

Inherited from

CameraControlBase._render

Defined in

control/CameraControlBase.ts:175


add()

add(...nodes): void

添加子节点

Parameters

• ...nodes: Node[]

Returns

void

Inherited from

CameraControlBase.add

Defined in

scene/Node.ts:276


changed()

changed(): void

标记对象为已修改

Returns

void

Inherited from

CameraControlBase.changed

Defined in

core/baseObject.ts:128


getRootNode()

getRootNode(): Node

Internal

获取根节点

Returns

Node

Inherited from

CameraControlBase.getRootNode

Defined in

scene/Node.ts:303


getRotation()

getRotation(): Number3

获取旋转信息

Returns

Number3

Inherited from

CameraControlBase.getRotation

Defined in

scene/Node.ts:132


getWorldDirection()

getWorldDirection(): Vec3

获取在世界空间下的朝向

Returns

Vec3

Inherited from

CameraControlBase.getWorldDirection

Defined in

scene/Node.ts:264


is()

is(t): boolean

Parameters

t: ClassEnum

Returns

boolean

Inherited from

CameraControlBase.is

Defined in

core/baseObject.ts:122


lock()

lock(): void

Returns

void

Defined in

control/pointerLockControl.ts:102


lookAt()

lookAt(target): void

看向某个点

Parameters

target: Vec3 = ...

Returns

void

Inherited from

CameraControlBase.lookAt

Defined in

scene/Node.ts:208


lookTo()

lookTo(direction): void

看向某个方向

Parameters

direction: Vec3

Returns

void

Inherited from

CameraControlBase.lookTo

Defined in

scene/Node.ts:220


registerChangeCB()

registerChangeCB(cb): () => void

添加变化回调

Parameters

cb

Returns

Function

Returns

void

Inherited from

CameraControlBase.registerChangeCB

Defined in

control/CameraControlBase.ts:129


release()

release(): void

销毁该对象

Returns

void

Overrides

CameraControlBase.release

Defined in

control/pointerLockControl.ts:100


remove()

remove(...nodes): void

移除子节点

Parameters

• ...nodes: Node[]

Returns

void

Inherited from

CameraControlBase.remove

Defined in

scene/Node.ts:290


reset()

reset(target?): void

Parameters

target?: Vec3

Returns

void

Defined in

control/pointerLockControl.ts:98


rotate()

rotate(__namedParameters): void

绕自身坐标系xyz轴旋转指定弧度

Parameters

__namedParameters

__namedParameters.dx?: number

__namedParameters.dy?: number

__namedParameters.dz?: number

Returns

void

Inherited from

CameraControlBase.rotate

Defined in

scene/Node.ts:189


rotateOnAxis()

rotateOnAxis(axis, radian): void

绕指定轴旋转

Parameters

axis: Vec3

radian: number

Returns

void

Inherited from

CameraControlBase.rotateOnAxis

Defined in

scene/Node.ts:173


rotateOnWorldAxis()

rotateOnWorldAxis(axis, radian): void

绕世界坐标系指定轴旋转

Parameters

axis: Vec3

radian: number

Returns

void

Inherited from

CameraControlBase.rotateOnWorldAxis

Defined in

scene/Node.ts:181


scale()

scale(__namedParameters): void

缩放节点

Parameters

__namedParameters

__namedParameters.dx?: number

__namedParameters.dy?: number

__namedParameters.dz?: number

Returns

void

Inherited from

CameraControlBase.scale

Defined in

scene/Node.ts:198


setGesture()

setGesture(gesture): void

设置手势

Parameters

gesture: Partial<object> = {}

Returns

void

Inherited from

CameraControlBase.setGesture

Defined in

control/CameraControlBase.ts:120


setMatrix()

setMatrix(m): void

设置模型的矩阵

Parameters

m: Mat4

Returns

void

Inherited from

CameraControlBase.setMatrix

Defined in

scene/Node.ts:114


setRotation()

setRotation(x, y, z): void

设置旋转

Parameters

x: number

y: number = x

z: number = x

Returns

void

Inherited from

CameraControlBase.setRotation

Defined in

scene/Node.ts:142


translate()

translate(param0): void

延xyz轴移动

Parameters

param0

param0.dx?: number

param0.dy?: number

param0.dz?: number

Returns

void

Inherited from

CameraControlBase.translate

Defined in

scene/Node.ts:162


translateOnAxis()

translateOnAxis(axis, distance): PointerLockControl

延指定轴移动

Parameters

axis: Vec3

distance: number

Returns

PointerLockControl

Inherited from

CameraControlBase.translateOnAxis

Defined in

scene/Node.ts:152


traverse()

traverse(cb): void

遍历执行

Parameters

cb

Returns

void

Inherited from

CameraControlBase.traverse

Defined in

scene/Node.ts:123


triggerChangeCB()

triggerChangeCB(): void

触发变化回调

Returns

void

Inherited from

CameraControlBase.triggerChangeCB

Defined in

control/CameraControlBase.ts:141


unlock()

unlock(): void

Returns

void

Defined in

control/pointerLockControl.ts:108


updateCamera()

updateCamera(): void

相机被更新时,应该更新control

Returns

void

Inherited from

CameraControlBase.updateCamera

Defined in

control/CameraControlBase.ts:148


updateLastState()

updateLastState(): void

Internal

更新上一次状态

Returns

void

Inherited from

CameraControlBase.updateLastState

Defined in

control/CameraControlBase.ts:163


updateMatrix()

updateMatrix(): void

更新本地矩阵

Returns

void

Inherited from

CameraControlBase.updateMatrix

Defined in

scene/Node.ts:228


updateWorldMatrix()

updateWorldMatrix(updateParant, updateChildren): void

更新世界矩阵

Parameters

updateParant: boolean = false

updateChildren: boolean = true

Returns

void

Inherited from

CameraControlBase.updateWorldMatrix

Defined in

scene/Node.ts:245