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.
- 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 |
|||||||||||||||||||||||||||||||||||||||
subTickCalculations |
boolean | Whether to calculate sub-ticks |
|||||||||||||||||||||||||||||||||||||||
pxlRoomRoot |
string | Path to room assets |
|||||||||||||||||||||||||||||||||||||||
pxlAssetRoot |
string | Path to asset assets |
|||||||||||||||||||||||||||||||||||||||
showOnboarding |
boolean | Whether to show onboarding |
|||||||||||||||||||||||||||||||||||||||
onboarding |
object | Onboarding settings 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.
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
},
'staticCamera' : false,
'autoCamera' : false,
'allowStaticRotation' : false,
'userSettings' : Object.assign({}, pxlUserSettings),
'subTickCalculations' : 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,
'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 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
},
}