387
edits
(24 intermediate revisions by the same user not shown) | |||
Line 134: | Line 134: | ||
After everything is checked go back into Object-Mode and select the Rig and the Mesh. Go to File -> Export -> .fbx <br> | After everything is checked go back into Object-Mode and select the Rig and the Mesh. Go to File -> Export -> .fbx <br> | ||
In Export Settings we only need the Armature and Mesh. Notice also make sure that "Selected Objects" is checked. Name your .fbx file properly and export it. | In Export Settings we only need the Armature and Mesh. Notice also make sure that "Selected Objects" is checked. Name your .fbx file properly and export it. | ||
[[File:file_menu_export.png|thumb|320px||left|How to Export]] | |||
[[File:export_settings.png|thumb|320px||left|Export Settings]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
==Importing the Rig in Unity== | |||
<br> | |||
Open Unity and create a new project. Call it as you like. | |||
[[File:create_new_project.png|thumb|320px||left|Creat New Project]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
Right click in your Assets folder -> Create -> Folder and name it. "Model".<br> | |||
To import your Model simply drag it from your destination Folder into Model or right click "Import new Asset" and select your fbx file.<br> | |||
Drag and Drop the Model into the "Hierarchy" on the left side. Move the character towards the Camera so we can see it better. | |||
[[File:create_folder.png|thumb|320px||left|Prepare Folder Steructures]][[File:import_model.png|thumb|320px||left|Import_Model]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
Once we extend the Cubeboy's Rig in the Hierarchy we can see our Bones. | |||
Ignone the once with a "_end" Tag. You also notice why we called our Mesh "Cubeboy_Mesh" so we can't get confused. | |||
[[File:cubeboy_hierarchy.png|thumb|320px||left|Hierarchy of Bones]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
==Setting up the Scripts== | |||
<br> | |||
Our next step will be to prepare an empty Gameobject where we will put in our OSC Scripts. <br>Go to Hierarchy right click -> "Create Empty" and call it "OSC_Script". | |||
[[File:create_empty.png|thumb|320px||left|Create an Empty Game Object]] | |||
<br> | |||
<br> | |||
<br style="clear:both"> | |||
<br> | |||
<br> | |||
Download the OSChandler Files on Github [https://github.com/heaversm/unity-osc-receiver | OSC for Unity] and Copypaste the Plugin Folder from Assets into your Asset Folder.<br> | |||
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: | |||
[[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