new Camera()
- Description:
Camera or pxlCamera class
- Source:
Methods
applyGravity(curCamPos) → {Vector3}
- Description:
Updates the camera position based on gravity and collisions. Delta ( camPos + gravity direction * gravity rate ) > ( Distance camPos to Collider Hit )
- Source:
Parameters:
Name | Type | Description |
---|---|---|
curCamPos |
Vector3 | The current camera position. |
Returns:
- The updated camera position.
- Type
- Vector3
buildDeviceMonitors()
- Description:
Builds device-pose monitors for gyroscope-enabled devices. CURRENTLY UNWORKING NOTE : Development in-progress through 'Device.js'
- Source:
camApplyMobileRotation()
- Description:
Applies mobile rotation to the camera. Mobile currently doesn't support movement in Rooms
Currently unused; awaiting mobile-gyroscope implementation
- Source:
camInitJump()
- Description:
Initializes the jump values for the camera.
- Source:
camJump(curTime)
- Description:
Handles the camera jump step. Step the jump while impulse isn't 0.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
curTime |
number | The current time. |
camJumpKey(jumpKeyIsDownopt)
- Description:
Handles the camera jump key press or release.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
jumpKeyIsDown |
boolean |
<optional> |
false
|
Whether the jump (Default : Space) key is pressed. |
checkColliderValid(curCamPos) → {number}
- Description:
Checks if the collider is valid. For GravitySource, make sure to get vector delta magnitude, not just Y delta
- Source:
Parameters:
Name | Type | Description |
---|---|---|
curCamPos |
Vector3 | The current camera position. |
Returns:
- The distance to the collider.
- Type
- number
colliderCheck(curCamPos) → {Vector3}
- Description:
Checks for main collider interactions. Ground plane, obstacles, and no terrain (If there are colliders in scene)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
curCamPos |
Vector3 | The current camera position. |
Returns:
- The updated camera position.
- Type
- Vector3
emitCameraTransforms(cameraPos, standingHeight, forceopt)
- Description:
Emits camera transforms to the server. NETWORKING HAS BEEN REMOVED, you'll need to implement your own server-side logic.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cameraPos |
Vector3 | The camera position. |
||
standingHeight |
number | The standing height. |
||
force |
boolean |
<optional> |
false
|
Whether to force the emission. |
eventCheck()
- Description:
Checks for events based on environment triggers. Currently only checking for Ground Collider, Room Warps, and Portals
- Source:
eventTrigger(checkObjectopt) → {boolean}
- Description:
Triggers an event based on the collider object. Currently supports inta-room portals, extra-room warp zones, and only 2 audio triggers. Custom triggers haven't been implemented yet, For any custom Collider Events, use the
castray()
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
checkObject |
string |
<optional> |
null
|
The collider object to check. |
Returns:
- Whether an event was triggered.
- Type
- boolean
fastTravel(hotkeyopt)
- Description:
Initiates fast travel to a specific location. This begins the warp effect process, It doesn't affect camera upon triggering, just queuing the warp event
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
hotkey |
number |
<optional> |
0
|
The hotkey for the fast travel location. |
getStandingHeight() → {number}
- Description:
Gets the standing height of the user. Head to Foot only - No landing, gravity, or walk-bounce
- Source:
Returns:
- The standing height.
- Type
- number
getUserHeight() → {number}
- Description:
Gets the user height including jump and walking-bounce offsets.
- Source:
Returns:
- The user height.
- Type
- number
init()
- Description:
Initializes the Camera class and Camera Worker.
- Source:
initFrameCamPosition() → {Vector3}
- Description:
Initializes the starting camera position per-frame. This is ran in
updateCamera()
- Source:
Returns:
- The initial camera position.
- Type
- Vector3
itemActive(curNameopt, curNameBaseopt) → {boolean}
- Description:
Activates an item.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
curName |
string |
<optional> |
null
|
The name of the item. |
curNameBase |
string |
<optional> |
null
|
The base name of the item. |
Returns:
- Whether the item was activated.
- Type
- boolean
itemCheck(curNameBase, validHit) → {boolean}
- Description:
Checks if an item was triggered. Currently only used as - if( !this.itemCheck(validHit) ){} Preventing standing on the item collider plane
- Source:
Parameters:
Name | Type | Description |
---|---|---|
curNameBase |
string | The base name of the item. |
validHit |
boolean | Whether the hit was valid. |
Returns:
- Whether the item was triggered.
- Type
- boolean
itemTrigger()
- Description:
Triggers a newly picked-up item. If no item is picked up, a random overlay-effect item is selected.
- Source:
jogServerMemory()
- Description:
Jog the server memory with the current camera position. Originally the server would use this event to update remote client's positions of the local user. Also as a server-side sanity check that the user is in the correct "chat" room and other data that may have gone stale. You'll need to implement your own usage of this function with server-side logic. CURRENTLY UNUSED
- Source:
jumpLanding(sendopt)
- Description:
Handles the jump landing, stopping the camera jump.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
send |
boolean |
<optional> |
true
|
Whether to send the landing event. |
killJumpImpulse()
- Description:
Kills the jump impulse. Space released before max jump
- Source:
lookAtTargetLock()
- Description:
Locks the camera to look at a target.
- Source:
lowQualityUpdates()
- Description:
Updates low-quality render events.
- Source:
midQualityUpdates()
- Description:
Updates mid-quality render events.
- Source:
resetCameraCalculations(newPosition)
- Description:
Resets camera calculations to a Vector3.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
newPosition |
Vector3 | The new position for the camera. |
resetGravity()
- Description:
Resets the gravity for the camera. Ran during Jump Landing, Room & Portal Warps currently
- Source:
setDependencies(pxlNav)
- Description:
Sets dependencies for the Camera class.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
pxlNav |
Object | The navigation object containing dependencies. |
setFOV(fov)
- Description:
Sets the field-of-view for the camera.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fov |
number | The field-of-view. |
setStats(fov, aspect, near, far)
- Description:
Sets camera stats including FOV, aspect ratio, near and far clipping planes. Used when changing Rooms
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fov |
number | The field of view. |
aspect |
number | The aspect ratio. |
near |
number | The near clipping plane. |
far |
number | The far clipping plane. |
setToObj(obj, lookAtopt)
- Description:
Best used without a
lookAt
target to allow the object's rotation to be adopted. If you just want to move the camera without rotational changes -or- to an object with a lookAt, it's better to usesetTransform
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
obj |
Object3D | The object to set the camera to. |
||
lookAt |
Object3D | string |
<optional> |
null
|
The lookAt Camera Position Name or target object. If a string is provided, it checks for the camera position if it exists in the Room, Ussuall set in your FBX file. |
setTransform(pos, lookAtopt)
- Description:
Sets the camera transform to a specific position and lookAt target. For camera position changes, portals, and room warps
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos |
Vector3 | The position to set the camera. |
||
lookAt |
Vector3 |
<optional> |
null
|
The lookAt target. |
step()
- Description:
Main step function to update camera state.
- Source:
updateCamera()
- Description:
Main update function for the camera.
- Source:
updateCameraMatrices()
- Description:
Updates camera matrices. Updates - Projection Matrix, Matrix World, & World Matrix
- Source:
updateDeviceValues(velEaseMag)
- Description:
Updates device values based on velocity easing magnitude.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
velEaseMag |
number | The current velocity magnitude. |
updateGravity()
- Description:
Updates the gravity for the camera. Gravity is updated and offset landing height with an ease back to standing upright
- Source:
updateMainValues(data)
- Description:
Updates main values from worker data. UNUSED CURRENTLY
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The data from the worker. |
updateMovement(curTime)
- Description:
Updates the movement based on the current time. Appling down directional key values to camera movement array
- Source:
Parameters:
Name | Type | Description |
---|---|---|
curTime |
number | The current time. |
updateRoamRotation()
- Description:
Updates the camera rotation; Look At(Aim) Target
Note: Known bug, static camera rotation is based on the current camera rotation This causes an inate rotation when the camera is moved to a new position
- Source:
warpCamRun()
- Description:
Runs the room warping camera effects.
- Source:
warpEventTriggered(visualTypeopt, warpObjopt, targetopt)
- Description:
Triggers a Room Warp / Portal Screen Effect event. This will initiate the visual effect and set the end warp object and target. The actual warp will be run in the
warpCamRun()
function on following frames.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
visualType |
number |
<optional> |
0
|
The type of visual effect. |
warpObj |
Object |
<optional> |
null
|
The warp object. |
target |
string |
<optional> |
'init'
|
The target of the warp. |
warpToRoom(roomName, startopt, objTargetopt)
- Description:
Warps the camera to a specific room.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
roomName |
string | The name of the room to warp to. |
||
start |
boolean |
<optional> |
false
|
Whether to run the room's |
objTarget |
Object3D |
<optional> |
null
|
The target object in the room. |