LoginSignup
9
9

More than 5 years have passed since last update.

[node-psvr]Node.jsでPSVRの加速度をとってみた #psvr

Last updated at Posted at 2016-10-20

Develop environment

Mac book pro OSX El captain (v10.11.5)

Node ver6.1.0

About node-psvr

https://github.com/hrl7/node-psvr

What you need

  1. PSVR
  2. Mac book

Setup

  1. Loop HDMI cable from HDMI-PS4 output to front HDMI Input(x □).
    14800966_1132723350130035_1286839215_n.jpg

  2. Connect USB cable to your PC.
    14804917_1132723346796702_752283711_n.jpg

  3. Connect AC adapter.

    14797432_1132723443463359_752603144_n.jpg

  4. Connect PSVR HDMI to your PC and other one to unit.
    14801172_1132723416796695_1180637633_n.jpg

Install node-psvr

$ mkdir psvr-tutorial
$ cd psvr-tutorial
$ npm init
$ npm install psvr --save
index.js
var PSVR = require("psvr");
var device = new PSVR();
device.on("data", function(data) {
   console.log(data);
});
$ node index.js
{ yawAccel: 0,
  pitchAccel: 0,
  rollAccel: 0,
  yaw: 0,
  pitch: 65,
  roll: 0,
  xAccel: 0,
  yAccel: 0,
  isWorn: 0 }
{ yawAccel: 0,
  pitchAccel: 0,
  rollAccel: 0,
  yaw: 0,
  pitch: 65,
  roll: -1,
  xAccel: 0,
  yAccel: -1,
  isWorn: 0 }
{ yawAccel: -1,
  pitchAccel: -1,
  rollAccel: -1,
  yaw: 0,
  pitch: 65,
  roll: -1,
  xAccel: -1,
  yAccel: -1,
  isWorn: 0 }

※If it does not work, check your connection to PSVR or try a few times.

Next step

use three.js and watch 360 movie or
make some simple game using three.js
[node-psvr]psvrの加速度をsocket.ioでhtmlに表示してみた #PSVR

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9