Members
#pxlEnums :Object
- Description:
pxlNav Enums
When a 'type' needs to be determined, enums help to show the available options.
Please see the pxlEnums class document for all the enum values.
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
pxlEnums |
Object | pxlNav {Enums} contains all the enums used in pxlNav |
VERBOSE_LEVEL |
Object | Console logging levels |
ANTI_ALIASING |
Object | Anti-aliasing settings |
RENDER_LAYER |
Object | Render Order Layers |
SKY_HAZE |
Object | Sky Haze settings |
SHADOW_MAP |
Object | Shadow edge softness settings |
CAMERA_EVENT |
Object | Camera event types |
COLLIDER_TYPE |
Object | Collider internal types |
GEOMETRY_SIDE |
Object | Geometry side types |
COLOR_SHIFT |
Object | Color space conversion options |
USER_SPEED |
Object | User speed settings |
DEVICE_TYPE |
Object | Input-Device Types |
DEVICE_EVENT |
Object | Input-Device Events |
DEVICE_BUTTON |
Object | Input-Device Buttons |
DEVICE_ACTION |
Object | Input-Device Actions |
HUD_ELEMENT |
Object | GUI & HUD Element types |
HUD_ACTION |
Object | GUI & HUD Element actions |
HUD_DRAW |
Object | GUI & HUD Element draw types |
pxlNav Enums
When a 'type' needs to be determined, enums help to show the available options.
Please see the pxlEnums class document for all the enum values.
Type:
- Object
pxlOptions
- Description:
Default options for pxlNav
Pass a pxlOptions object to the pxlNav constructor to override these defaults.
Note : From
postProcessPasses, onlypostProcessPasses.roomGlowPassis implemented currently
The passes are all added, but options to control them are not yet implemented
However,
lizardKingPass,starFieldPass, andcrystallinePasscan be triggered manually onpxlUser
They will be implemented through triggers in a future version ofpxlNav
- Source:
Properties:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
verbose |
number | Verbosity level for console logging |
|||||||||||||||||||||||||||||||||||||||
fps |
object | Frames per second settings Properties
|
|||||||||||||||||||||||||||||||||||||||
staticCamera |
boolean | Whether the camera is static |
|||||||||||||||||||||||||||||||||||||||
autoCamera |
boolean | Whether the camera is automatically controlled |
|||||||||||||||||||||||||||||||||||||||
allowStaticRotation |
boolean | Whether static rotation is allowed |
|||||||||||||||||||||||||||||||||||||||
userSettings |
pxlUserSettings | User settings for pxlNav; set to a |
|||||||||||||||||||||||||||||||||||||||
subFrameCalculations |
boolean | Whether to run sub-frame calculations.
|
|||||||||||||||||||||||||||||||||||||||
pxlRoomRoot |
string | Path to pxlRoom root path |
|||||||||||||||||||||||||||||||||||||||
pxlAssetRoot |
string | Path to pxlAsset root path |
|||||||||||||||||||||||||||||||||||||||
showOnboarding |
boolean | Whether to show the 'Onboarding' how-to intro screen |
|||||||||||||||||||||||||||||||||||||||
onboarding |
object | Onboarding settings object Properties
|
|||||||||||||||||||||||||||||||||||||||
loaderPhrases |
Array.<string> | Loader phrases |
|||||||||||||||||||||||||||||||||||||||
antiAliasing |
string | Anti-aliasing level |
|||||||||||||||||||||||||||||||||||||||
collisionScale |
object | Collision scale settings Properties
|
|||||||||||||||||||||||||||||||||||||||
shadowMapBiasing |
string | Shadow map biasing level |
|||||||||||||||||||||||||||||||||||||||
loadEnvAssetFile |
boolean | Whether to load environment asset file |
|||||||||||||||||||||||||||||||||||||||
skyHaze |
string | Sky haze level |
|||||||||||||||||||||||||||||||||||||||
postProcessPasses |
object | Post-process passes settings Properties
|
Default options for pxlNav
Pass a pxlOptions object to the pxlNav constructor to override these defaults.
Note : From postProcessPasses, only postProcessPasses.roomGlowPass is implemented currently
The passes are all added, but options to control them are not yet implemented
However,
lizardKingPass, starFieldPass, and crystallinePass can be triggered manually on pxlUser
They will be implemented through triggers in a future version of pxlNav
Examples
// Example usage
import { pxlNav, pxlOptions } from './pxlNav.js';
// Project name
const projectTitle = "Test Project";
// Booting rooms
const startingRoom = "YourEnvironment";
const bootRoomList = [startingRoom];
// Target FPS (Frames Per Second)
// Default is - PC = 60 -&- Mobile = 30
const targetFPS = {
'pc' : 45,
'mobile' : 30
};
// Copy the default options
let pxlNavOptions = Object.assign({},pxlOptions);
pxlNavOptions.fps = targetFPS;
const pxlNavEnv = new pxlNav( pxlNavOptions, projectTitle, startingRoom, bootRoomList );
pxlNavEnv.init();
export const pxlOptions = {
'verbose' : pxlEnums.VERBOSE_LEVEL.NONE,
'fps' : {
'pc' : 60,
'mobile' : 30
},
'renderScale' : {
'pc' : 1.0,
'mobile' : 1.0
},
'staticCamera' : false,
'autoCamera' : false,
'allowStaticRotation' : false,
'userSettings' : Object.assign({}, pxlUserSettings),
'subFrameCalculations' : false,
'pxlRoomRoot' : "./pxlRooms",
'pxlAssetRoot' : "./pxlAssets",
'showOnboarding' : true,
'onboarding' : {
'pc' : {
'message' : "Welcome to<br>%projectTitle%",
'messageStyle' : ['pxlGui-welcome-message'],
'buttonText' : "close",
'buttonStyle' : ['guiButton']
},
'mobile' : {
'message' : "Welcome to<br>%projectTitle%",
'messageStyle' : ['pxlGui-mobile-body'],
'buttonText' : "start",
'buttonStyle' : ['guiButton', 'pxlGui-mobile-welcomeButton']
}
},
'loaderPhrases' : ['...loading the pixels...'],
'antiAliasing' : pxlEnums.ANTI_ALIASING.LOW,
'collisionScale' : {
'gridSize' : 50,
'gridReference' : 1000
},
'shadowMapBiasing' : pxlEnums.SHADOW_MAP.BASIC,
'loadEnvAssetFile' : false,
'skyHaze' : pxlEnums.SKY_HAZE.OFF,
'postProcessPasses' : { // Enabling these use assets from ` pxlAssetRoot : './pxlAssets' `
'roomGlowPass' : false,
'motionBlurPass' : false,
'mapComposerWarpPass' : false,
'chromaticAberrationPass' : false,
'lizardKingPass' : false,
'starFieldPass' : false,
'crystallinePass' : false
}
}
pxlUserSettings
- Description:
User settings for pxlNav
- Source:
Properties:
| Name | Type | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
height |
object | User height settings Properties
|
|||||||||||||||||||||
movement |
object | User movement settings Properties
|
|||||||||||||||||||||
look |
object | User look settings Properties
|
|||||||||||||||||||||
headBounce |
object | User head bounce settings Properties
|
|||||||||||||||||||||
jump |
object | User jump settings Properties
|
|||||||||||||||||||||
gravity |
object | User gravity settings Properties
|
|||||||||||||||||||||
deadZone |
object | User dead zone settings. The amount of 'tilt' or movement before the input is recognized Properties
|
User settings for pxlNav
Examples
// Example usage
import { pxlNav, pxlUserSettings, pxlOptions } from './pxlNav.js';
// Project name
const projectTitle = "Test Project";
// Booting rooms
const startingRoom = "YourEnvironment";
const bootRoomList = [startingRoom];
// User settings for the default/initial pxlNav environment
// These can be adjusted from your `pxlRoom` but easily set defaults here
const userSettings = Object.assign({}, pxlUserSettings);
userSettings['height']['standing'] = 1.75; // Standing height in units; any camera in your room's FBX will override this height once loaded
userSettings['height']['stepSize'] = 5; // Max step height in units
// Copy the default options
let pxlNavOptions = Object.assign({},pxlOptions);
pxlNavOptions.userSettings = userSettings;
const pxlNavEnv = new pxlNav( pxlNavOptions, projectTitle, startingRoom, bootRoomList );
pxlNavEnv.init();
export const pxlUserSettings = {
'height' : {
'standing' : 1.75, // Standing height in units; any camera in your room's FBX will override this height once loaded
'stepSize' : 5 // Max step height in units
},
'movement' : {
'scalar' : 1.0, // Overall movement rate scalar
'max' : 10.0, // Max movement speed
'easing' : 0.55, // Easing rate between Step() calls
},
'look' : {
'pc' : {
'invert' : false // Invert ( Southpaw ) look on desktop
},
'mobile' : {
'invert' : false // Invert look on mobile
}
},
'headBounce' : {
'height' : 0.3, // Bounce magnitude in units
'rate' : 0.025, // Bounce rate per Step()
'easeIn' : 0.03, // When move key is pressed, the ease into bounce; `bounce * ( boundInf + easeIn )`
'easeOut' : 0.95 // When move key is let go, the ease back to no bounce; `bounce * easeOut`
},
'jump' : {
'impulse' : 0.75, // Jump impulse force applied to the player while holding the jump button
'holdMax' : 2.85, // Max influence of holding the jump button on current jump; in seconds
'repeatDelay' : 0.08 // Delay between jumps when holding the jump button
},
'gravity' : {
'ups' : 0.3, // Units per Step() per Step()
'max' : 15.5 // Max gravity rate
},
'deadZone' : {
'controller' : 0.10, // Dead zone for controller input, in stick tilt
'touch' : 20, // Dead zone for touch input, in pixels
'xr' : 0.10 // Dead zone for XR input, in hand detection precision
},
}