KeyboardCameraManipulator
Methods
calculateCurrentDirection
Update active camera direction, depending on currently pressed keys.
endMovement
Cancel any ongoing camera movement.
getDirectionFromKey
Returns the direction vector of the given camera for the given key.
| Argument | Type | Required | Description |
|---|---|---|---|
key | Yes | the movedkey | |
camera | Yes | the camera |
getInteractor
Get the interactor associated with the current movement.
getMoveBackwardKeys
Get the keys that trigger a backward movement.
getMoveDownKeys
Get the keys that trigger a downward movement.
getMoveForwardKeys
Get the keys that trigger a forward movement.
getMoveLeftKeys
Get the keys that trigger a leftward movement.
getMoveRightKeys
Get the keys that trigger a rightward movement.
getMoveUpKeys
Get the keys that trigger an upward movement.
getMovementSpeed
Get the movement speed.
getRenderer
Get the renderer associated with the current movement.
inMotion
Returns whether a movement is ongoing.
moveCamera
Moves the given camera, in the given direction, at the given speed.
| Argument | Type | Required | Description |
|---|---|---|---|
camera | Yes | the moved camera | |
direction | Yes | the direction of the movemnt | |
speed | Yes | the speed |
onKeyDown
Handles a keydown event.
| Argument | Type | Required | Description |
|---|---|---|---|
interactor | Yes | the interactor | |
renderer | Yes | the renderer | |
key | Yes | the key |
onKeyPress
Handles a keypress event.
| Argument | Type | Required | Description |
|---|---|---|---|
interactor | Yes | the interactor | |
renderer | Yes | the renderer | |
key | Yes | the key |
onKeyUp
Handles a keyup event.
| Argument | Type | Required | Description |
|---|---|---|---|
interactor | Yes | the interactor | |
renderer | Yes | the renderer | |
key | Yes | the key |
resetMovementSpeed
Reset the movement speed to be proportional to the longest length of the renderer's bounds.
setInteractor
Set the interactor associated with the current movement.
| Argument | Type | Required | Description |
|---|---|---|---|
interactor | Yes |
setMoveBackwardKeys
Set the keys that trigger a backward movement.
| Argument | Type | Required | Description |
|---|---|---|---|
keys | Yes |
setMoveDownKeys
Set the keys that trigger a downward movement.
| Argument | Type | Required | Description |
|---|---|---|---|
keys | Yes |
setMoveForwardKeys
Set the keys that trigger a forward movement.
| Argument | Type | Required | Description |
|---|---|---|---|
keys | Yes |
setMoveLeftKeys
Set the keys that trigger a leftward movement.
| Argument | Type | Required | Description |
|---|---|---|---|
keys | Yes |
setMoveRightKeys
Set the keys that trigger a rightward movement.
| Argument | Type | Required | Description |
|---|---|---|---|
keys | Yes |
setMoveUpKeys
Set the keys that trigger an upward movement.
| Argument | Type | Required | Description |
|---|---|---|---|
keys | Yes |
setMovementSpeed
Set the movement speed.
| Argument | Type | Required | Description |
|---|---|---|---|
speed | Yes |
setRenderer
Set the renderer associated with the current movement.
| Argument | Type | Required | Description |
|---|---|---|---|
renderer | Yes |
startMovement
Initialize a movement of the current camera.