Skip to content

Instantly share code, notes, and snippets.

@enukane
Last active December 20, 2015 03:08
Show Gist options
  • Select an option

  • Save enukane/6061069 to your computer and use it in GitHub Desktop.

Select an option

Save enukane/6061069 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'websocket-client-simple'
ws = WebSocket::Client::Simple.connect "ws://localhost:6437/"
ws.on :message do |msg|
puts msg.data
end
ws.on :open do
ws.send "{enableGestures: true}"
end
loop do
ws.send STDIN.gets.strip
end
=begin
バージョン(最初にでる)
{"version":1}
ジェスチャしない段階での情報
{"currentFrameRate":19.8192,"gestures":[],"hands":[],"id":63496,"interactionBox":{"center":[0,200,0],"size":[221.418,221.418,154.742]},"pointables":[],"r":[[-0.862833,-0.351985,0.362803],[0.29003,0.243113,0.925623],[-0.414008,0.903882,-0.10768]],"s":-80.4545,"t":[3638.29,-5859.61,6061.92],"timestamp":24578857579}
ジェスチャ中の情報
{"currentFrameRate":87.233,"gestures":[],"hands":[{"direction":[0.0427526,0.343767,-0.938081],"id":85,"palmNormal":[-0.0278685,-0.938164,-0.345067],"palmPosition":[-8.08021,122.607,-16.6002],"palmVelocity":[-4.54087,-78.8378,1.46996],"r":[[0.99635,-0.0853603,-0.00068253],[0.0852906,0.995144,0.0491405],[-0.00351543,-0.0490193,0.998792]],"s":1.05511,"sphereCenter":[-11.4689,58.7012,-67.3972],"sphereRadius":96.1226,"stabilizedPalmPosition":[-8.07965,122.617,-16.6004],"t":[-17.6625,-27.7224,-5.70902],"timeVisible":0.294424}],"id":38301,"interactionBox":{"center":[0,200,0],"size":[221.418,221.418,154.742]},"pointables":[{"direction":[-0.0230632,-0.157163,-0.987303],"handId":85,"id":39,"length":71.5159,"stabilizedTipPosition":[-14.685,137.711,-116.936],"timeVisible":0.466926,"tipPosition":[-14.6652,137.636,-116.94],"tipVelocity":[28.4389,-13.7647,2.02438],"tool":false,"touchDistance":0.306822,"touchZone":"hovering"},{"direction":[-0.151525,-0.0497816,-0.987199],"handId":85,"id":56,"length":62.6919,"stabilizedTipPosition":[-50.3195,139.382,-106.617],"timeVisible":0.430276,"tipPosition":[-50.315,139.356,-106.621],"tipVelocity":[28.8252,-24.2601,-11.3754],"tool":false,"touchDistance":0.310971,"touchZone":"hovering"},{"direction":[0.0553507,-0.14186,-0.988338],"handId":85,"id":51,"length":64.9083,"stabilizedTipPosition":[20.8017,130.018,-105.286],"timeVisible":0.430276,"tipPosition":[20.8329,129.886,-105.313],"tipVelocity":[21.5899,-32.1764,-16.259],"tool":false,"touchDistance":0.32,"touchZone":"hovering"},{"direction":[-0.205239,-0.0640734,-0.976612],"handId":85,"id":31,"length":38.546,"stabilizedTipPosition":[-68.6856,127.417,-76.0008],"timeVisible":0.40571,"tipPosition":[-68.6839,127.408,-76.0016],"tipVelocity":[22.5156,-19.4661,1.59944],"tool":false,"touchDistance":0.318806,"touchZone":"hovering"},{"direction":[0.285999,0.0834808,-0.954587],"handId":85,"id":38,"length":38.5263,"stabilizedTipPosition":[49.1038,123.6,-46.2363],"timeVisible":0.40571,"tipPosition":[49.15,123.52,-46.1877],"tipVelocity":[17.165,-14.4331,20.6234],"tool":false,"touchDistance":0.347154,"touchZone":"hovering"}],"r":[[-0.985016,-0.13007,0.113251],[-0.132056,0.99119,-0.0101816],[-0.110929,-0.0249845,-0.993514]],"s":-58.1509,"t":[1979.22,-4425.21,2918.37],"timestamp":23774398653}
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment