The javascript SDK for connecting to a Perceptoscope over it's WAMP WebSocket. Works in both NodeJS and the browser.
var pscope = new Perceptoscope('ws://localhost:3000');
pscope.on(Perceptoscope.Events.ROTATION, rotation => {
console.log(rotation);
});
pscope.connect();
See /examples
directory for additional example code.
A connection to perceptope
Extends: EventEmitter
- Perceptoscope ⇐
event.EventEmitter
- new Perceptoscope(url)
- instance
- .url ⇒
string
- .rotation ⇒
Quaternion
- .hmd ⇒
HMD
- .position ⇒
Point
- .connect() ⇒
Promise
- .close()
- .url ⇒
- static
Creates a Perceptope
Param | Type | Description |
---|---|---|
url | string |
The websocket url to the perceptoscope ex. ws://localhost:3000 |
The url of the websocket conection
perceptoscope.rotation ⇒ Quaternion
The current rotation
perceptoscope.hmd ⇒ HMD
Current HMD (Head Mounted Display) configurations
perceptoscope.position ⇒ Point
Current position of the perceptoscope
Connects to a perceptoscope and fetches intial values for rotation, position and hmd.
Closes the connection
Properties
Name | Value | Description |
---|---|---|
ROTATION | "rotation" |
Fired when rotation changes |
POSITION | "position" |
Fired when position changes |
HMD | "position" |
Fired when hmd changes |
CONNECTED | "position" |
Fired when pscope is connected and has initial data |
Properties
Name | Type |
---|---|
x | number |
y | number |
z | number |
w | number |
Properties
Name | Type |
---|---|
x | number |
y | number |
z | number |
Properties
Name | Type |
---|---|
fov | FieldOfView |
left | Eye |
right | Eye |
Properties
Name | Type |
---|---|
upDegrees | number |
rightDegrees | number |
downDegrees | number |
leftDegrees | number |
Properties
Name | Type |
---|---|
renderRect | Rect |
eyeTranslation | Point |
Properties
Name | Type |
---|---|
x | number |
y | number |
width | number |
height | number |