{"id":1135,"date":"2018-02-13T19:53:35","date_gmt":"2018-02-13T18:53:35","guid":{"rendered":"http:\/\/jmladeno.net\/?p=1135"},"modified":"2018-02-13T21:57:06","modified_gmt":"2018-02-13T20:57:06","slug":"receive-streams-in-unity-e-g-from-openvibe","status":"publish","type":"post","link":"https:\/\/jmladeno.net\/index.php\/2018\/02\/13\/receive-streams-in-unity-e-g-from-openvibe\/","title":{"rendered":"Receive streams in Unity (e.g. from openvibe)"},"content":{"rendered":"<p>In my example (Roll a Ball from Unity tutorial)<br \/>\nI wish to move the gameObject &#8212; the Player (the ball)<br \/>\naccording to the incoming streams from openvibe.<\/p>\n<p>First, modify the script from LSL4Unity,\u00a0ExampleFloatInlet:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-1161\" src=\"http:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lastsample-300x190.png\" alt=\"\" width=\"582\" height=\"369\" srcset=\"https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lastsample-300x190.png 300w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lastsample-768x487.png 768w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lastsample-1024x649.png 1024w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lastsample.png 1430w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Drag and Drop the ExampleFloatInlet Script onto your gameObject and name accordingly the Stream Name and Type (here, openvibeSignal and Nothing for type!!)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1155 aligncenter\" src=\"http:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/Capture-1-300x146.png\" alt=\"\" width=\"420\" height=\"205\" srcset=\"https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/Capture-1-300x146.png 300w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/Capture-1-768x373.png 768w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/Capture-1-1024x497.png 1024w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/Capture-1.png 1158w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/p>\n<p>Then in your code, where you manipulate that game object (here PlayerController) write:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\" wp-image-1137 alignleft\" src=\"http:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/codeInlet-300x267.png\" alt=\"\" width=\"310\" height=\"276\" srcset=\"https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/codeInlet-300x267.png 300w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/codeInlet-768x683.png 768w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/codeInlet.png 792w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>in Start () write <strong>inlet = FindObjectOfType&lt;ExampleFloatInlet&gt;()<\/strong>;<\/p>\n<p>I wish to move the object using generated openvibe signals. So, to move the ball here, I type in PlayerController script:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1138 alignleft\" src=\"http:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/inletMove-300x107.png\" alt=\"\" width=\"443\" height=\"158\" srcset=\"https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/inletMove-300x107.png 300w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/inletMove-768x274.png 768w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/inletMove-1024x365.png 1024w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/inletMove.png 1130w\" sizes=\"auto, (max-width: 443px) 100vw, 443px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>In Openvibe, for which ever signal (here artificial sinusoids), in the acquisition server select Preferences and check the LSLOutput!!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-1148\" src=\"http:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/generic-300x97.png\" alt=\"\" width=\"426\" height=\"138\" srcset=\"https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/generic-300x97.png 300w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/generic-768x248.png 768w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/generic-1024x330.png 1024w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/generic-1440x464.png 1440w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/generic.png 1598w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1149 alignleft\" src=\"http:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lslOV-281x300.png\" alt=\"\" width=\"314\" height=\"335\" srcset=\"https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lslOV-281x300.png 281w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lslOV-768x819.png 768w, https:\/\/jmladeno.net\/wp-content\/uploads\/2018\/02\/lslOV.png 782w\" sizes=\"auto, (max-width: 314px) 100vw, 314px\" \/>here you can notice the <em>openvibe name<\/em> you need to write in Unity for it to recognize the incoming stream! And as there is no type indicated in openvibe, please leave that space blanc in Unity, otherwise it wont work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my example (Roll a Ball from Unity tutorial) I wish to move the gameObject &#8212; the Player &hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1135","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/posts\/1135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/comments?post=1135"}],"version-history":[{"count":33,"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/posts\/1135\/revisions"}],"predecessor-version":[{"id":1186,"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/posts\/1135\/revisions\/1186"}],"wp:attachment":[{"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/media?parent=1135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/categories?post=1135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jmladeno.net\/index.php\/wp-json\/wp\/v2\/tags?post=1135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}