forked from Blender-Brussels/blender-oculus-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathriftosc.py
36 lines (25 loc) · 794 Bytes
/
riftosc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from rift import PyRift
from pyOSC import OSCClient, OSCMessage
rotrift = PyRift()
def initialisation():
client = OSCClient()
client.connect( ("127.0.0.1", 7120) )
def send():
client = OSCClient()
message = OSCMessage()
message.setAddress("/user/1")
message.append([rotrift.rotation[0],
rotrift.rotation[1],
rotrift.rotation[2],
rotrift.rotation[3]])
#client.send( message, message.append([arg1, arg2, arg3])
#client.send( message)
try:
client.sendto(message, ('127.0.0.1', 7120))
message.clearData()
except:
print('connection refused')
while True:
rotrift.poll()
print("rotation quat: %f %f %f %f" % (rotrift.rotation[0], rotrift.rotation[1], rotrift.rotation[2], rotrift.rotation[3]))
send()