387
edits
No edit summary |
(→Step4) |
||
(29 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
The following script I will provide contains the whole setup you need to recieve data from '''The Captury''' and constantly updating it in '''Unity''' | The following script I will provide contains the whole setup you need to recieve data from '''The Captury''' and constantly updating it in '''Unity''' | ||
<br> | |||
<br> | |||
Here is the File: [[Media:osc_script.zip|OSC_Reciever.js]] | |||
==IMPORTANT== | |||
Be aware that the '''OSC''' and the '''UDPPacketIO''' Scripts are in the Folder called '''Plugin'''<br>Also be sure to not have the Scripts twice in the Unity '''Assets''' Folder.<br><br> | |||
Create an Empty GameObject were you put all ''three'' Scripts in and call it as you like e.g. '''OSCHandler'''. | |||
<br> | <br> | ||
===Step1=== | ===Step1=== | ||
Line 15: | Line 23: | ||
'''SendToPort''': is where we type in the UDP Port set in The Captury. Actually it's -- '''1065''' -- | '''SendToPort''': is where we type in the UDP Port set in The Captury. Actually it's -- '''1065''' -- | ||
<br> | <br> | ||
'''ListenerPort''': can be | '''ListenerPort''': can also be 1065. | ||
<br> | <br> | ||
<br> | <br> | ||
Line 21: | Line 29: | ||
<br> | <br> | ||
<br> | <br> | ||
[[File: | The '''controller''' variable isn't important for us. Don't confound it with the gameReciever tab in your editor. | ||
<br> | |||
<br> | |||
[[File:oscreciever1_new.png]] | |||
<br> | <br> | ||
===Step2=== | ===Step2=== | ||
Before we go further we have to first set up variables for each coordinate because those will recieve values from the OSCMessage | Before we go further we have to first set up variables for each coordinate because those will recieve values from the OSCMessage | ||
Line 32: | Line 44: | ||
<br> | <br> | ||
===Step3=== | ===Step3=== | ||
In this start function wie call both scripts: OSC and UDPPacketIO. | |||
<br> | |||
<br> | |||
[[File:oscreciever3_new.png]] | |||
<br> | |||
<br> | |||
The '''OnDisable''' function will close the UDP sockets of the listener | |||
<br> | |||
<br> | |||
[[File:oscreciever6_new.png]] | |||
===Step4=== | |||
This are our Update Functions: | |||
<br> | |||
All values which will be parsed from Step5 will be constantly updated here. | |||
<br> | |||
We can now chose even if we want the objects to be transformed or rotated or whatever. | |||
<br> | |||
The '''Time.frameCount''' will constantly resubscribe every 60 frames. The first value means the ''framrate'' the last one the ''scale factor''. | |||
<br> | |||
<br> | |||
'''Subscription''': instead of the ''Root'' you can use any bone described in The Captury. E.g.: ''Left_Arm'' | |||
<br> | |||
<br> | |||
'''NOTICE''': yourname etc. is just set up in the Script for comprehension. Please replace it with the name you set up in The Captury.(User_Green_Socket) | |||
<br> | |||
<br> | |||
[[File:oscreciever4_new.png]] | |||
<br> | |||
<br> | |||
[[File:oscreciever5_new.png]] | |||
===Step5=== | |||
In our last step we define which values we want from the captury to parse them in the update function. | |||
<br> | |||
Also be aware to change the name of "Person_One" to the one you use in The Captury as mentioned above. | |||
<br> | <br> | ||
<br> | <br> | ||
[[File: | [[File:oscreciever10_new.png]] | ||
edits