Open jessegreenberg opened 5 years ago
This was pretty simple to set up, changes to sim code were almost identical to changes for nexus in #117 (which also is driven by WebSocket). The tricky part was setting up the server. This documentation is in the branch in WOASModel.
// hacks for websocket!!
// NOTE: You will have to change this IP to the devices adress, and the devices MUST be on the same network
// Take a look at this example on how to set up a websocket with npm:
// https://www.sitepoint.com/real-time-apps-websockets-server-sent-events/
//
// Then in the client webpage, add a listener to the page that monitors device orientation like
// var handleOrientation = function( event ) {
// var absolute = event.absolute;
// var alpha = event.alpha;
// var beta = event.beta;
// var gamma = event.gamma;
//
// var json = JSON.stringify( {
// message: 'orientation event',
// beta: beta,
// absolute: event.absolute,
// alpha: event.alpha,
// gamma: event.gamma
// } );
// socket.send(json);
// }
Like #117. But instead of using nexus we are using a basic websocket. Once a server is set up, the WebSocket can be used to control the position of the wrench by the orientation of a phone or mobile device.