Constructor
new CameraManager(context, object3D, variables)
Name | Type | Description |
---|---|---|
context | Context | game external context |
object3D | Object3D | object3D attach to this script |
variables | object | script variables |
- Source
Classes
Members
cameraDistance :number
- number
- Source
computeCameraDistance :function
- function
- Source
currentMovement :Movement|null
- Movement |
null
- Source
obstacle :THREE.Object3D
When computing camera transform obstacle is considered in the computation
- THREE.
Object3D
- Source
raycaster :THREE.Raycaster
Raycaster to avoid obstacle
- THREE.
Raycaster
- Source
target :Target|null
target object3D
- Target |
null
- Source
Methods
computeCameraTransform(object3D, distance, offset, angle) → {Object}
Compute camera transform (position + quaternion) to focus object3D
Name | Type | Description |
---|---|---|
object3D | THREE. | object3D to focus |
distance | number | distance from object3D |
offset | Object | offset camera position |
angle | number | angle on x |
- Source
- transform of camera
- Type:
- Object
currentMovement()
This function is going to be tick in this.tick
.
- Source
- See
currentMovement()
This function is going to be tick in this.tick
. @see Movement
- Source
followObject3D(object3D, distance, offset, angle)
Camera start following object3D target
Name | Type | Description |
---|---|---|
object3D | THREE. | object3D to focus |
distance | number | distance from object3D |
offset | Object | offset camera position |
angle | number | angle on x |
- Source
moveToBoundingBox(bb, duration) → {Promise.<boolean>}
Move camera to bounding box
Name | Type | Description |
---|---|---|
bb | THREE. | bounding box |
duration | number | time movement in ms |
- Source
- promise resolving when movement is done resolve with true if movement occured false otherwise
- Type:
- Promise.<boolean>
moveToObject3D(object3D, duration, distance, offset, angle) → {Promise}
Camera move to object3D
Name | Type | Description |
---|---|---|
object3D | THREE. | object3D to focus |
duration | number | time of movement in ms |
distance | number | distance from object3D |
offset | Object | offset camera position |
angle | number | angle on x |
- Source
- promise resolving when movement is done resolve with true if movement occured false otherwise
- Type:
- Promise
moveToTransform(position, quaternion, duration) → {Promise.<boolean>}
Move camera to transform (position + quaternion)
Name | Type | Description |
---|---|---|
position | THREE. | target camera position |
quaternion | THREE. | target camera quaternion |
duration | number | time of movement in ms |
- Source
- promise resolving when movement is done resolve with true if movement occured false otherwise
- Type:
- Promise.<boolean>
setObstacle(value)
Name | Type | Description |
---|---|---|
value | THREE. | obstacle |
- Source
stopFollowObject3D()
Stop following object3D target
- Source
tick()
Step the current movement if there is not follow a target if not nothing
- Source