387
edits
(13 intermediate revisions by the same user not shown) | |||
Line 179: | Line 179: | ||
Download this modified [[Media:OSC_Reciever.zip | OSC_Reciever Script]] and paste it to a new Folder called "Scripts". | Download this modified [[Media:OSC_Reciever.zip | OSC_Reciever Script]] and paste it to a new Folder called "Scripts". | ||
Select your Empty called "OSC_Script" and click on "Add Component" and search for all three Scripts and add them. It should look like this: | Select your Empty called "OSC_Script" and click on "Add Component" and search for all three Scripts and add them. It should look like this: | ||
[[File:add_scripts.png|thumb|320px||left|Adding Scripts to Object]] | |||
[[File:osc_setup.png|thumb|320px||left|Script Setup]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
==Bone Overview The Captury== | |||
<br> | |||
Switch to The Captury and go into Playback Mode. Select your Recording.<br> | |||
On the right Panel you can see the "Skeleton Types" tab. Click on it and a whole list will appear which every single bone.<br> | |||
The bone names we need are the ones with the white background. These are the bones which we need to set up in our OSC_Reciever script. | |||
[[File:playback_mode.png|thumb|400px||left|Playback Mode]] | |||
[[File:skeleton_types.png|thumb|400px||left|Skeleton Types]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
==Modifying the OSC Script in Unity== | |||
<br> | |||
Since these steps are going to be repetitive I will show you how to set up two bones for the OSC Messages between Unity and The Captury.<br> | |||
Open the OSC_Reciever script in Unity by default with "Viusal Studio" or "Monodevelop". Go to line "60" and "63" and change the "yourname" according to your recording. | |||
<source lang="javascript"> | |||
msg = handler.StringToOscMessage("/subscribe/yourname/blender/Root/vector 50.0 0.0 20.0"); | |||
handler.Send(msg); | |||
msg = handler.StringToOscMessage("/subscribe/yourname/blender/Head/vector 50.0 0.0 20.0"); | |||
handler.Send(msg); | |||
</source> | |||
Also change it in line "101" adn "107". | |||
<source lang="javascript"> | |||
switch (msgAddress){ | |||
case "/yourname/blender/Root/vector": | |||
hips_x = values[0]; | |||
hips_y = values[1]; | |||
hips_z = values[2]; | |||
break; | |||
case "/yourname/blender/Head/vector": | |||
head_x = values[0]; | |||
head_y = values[1]; | |||
head_z = values[2]; | |||
break; | |||
default: | |||
// | |||
break; | |||
} | |||
</source> | |||
<br> | |||
'''Notice''': You can also change the Bone types coming from The Captury. E.g you don't want to animate the "Head" bone, change it to which ever bone you like. Save your Script.<br><br> | |||
Now go back to Unity. In the Editor on the right. Once the OSC_Script is selected, type in the bones from your Model not the ones from The Captury. | |||
You can see them in the Hierarchy. | |||
[[File:osc_setup.png|thumb|320px||left|Modifying the Script]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
==Run Everything== | |||
<br> | |||
Be sure everything is set up correctly (Message string / Bonenames / Modelbones / Ports / Remote IP) before you run The Captury and Unity. | |||
<br> | |||
Run The Captury in "Playback Mode" looping. Run Unity. Your Character shall move now. | |||
<br> | |||
<br> | |||
<br> | |||
'''Thank you!''' |
edits