This week I worked with Nicole on implementing OSC into our current version of Pillow Fright. This involved a lot of research, learning, and trial and error. Using an opensource code from GitHub (https://github.com/heaversm/unity-osc-receiver) and watching the connected tutorial (https://vimeo.com/95584442), I started to understand how to implement OSC into Unity. So using this code and what I had learned from the tutorial and other online resources, I began to connect the OSC receiver to Unity. Currently, in theory, when sent the case message the Receiver should send "keyPressed" prompts to the Unity file (http://answers.unity3d.com/questions/28473/simulating-key-presses.html), which will make our character interact with its enemies.
In the future I plan to work on testing the code and working with Nicole on setting up the Sender side of the OSC aspect of the project. This way we will be able to tell if the code actually works.
Failures - What did not work out as planned? Why not? What did you learn and how would you approach it differently next time?
What did not work out as planned was attempting to use a non-local remote IP with the OSC application. In order to test the code, it requires a sender. And because the sender code is not yet completely ready I had hoped to try to use it with a remote Sender application on my cellphone. But the applications require the OSC to access a remote IP, which I was unable to set up on the computer at Carleton University (because of the installation restrictions). This code would in theory work locally, but again with the installation restrictions I was unable to test it.
Next time I will be working with Nicole directly, so she will be able to test the code locally anyways. If this is not an option for whatever unknown circumstance, I will have to install the correct software on a personal computer or an Algonquin College computer.
Successes - What did go well? What approach(es) did you take?
What went well was following along with the tutorial and making notes along the way in order to generate a better understanding and a future reference of how to use the GitHub code and how to use it with our project. These notes include:
Port(outgoing) = 8000 - touchOSC sends messages out on port 8000
Port(Incoming) = 9000 = recieves them on port 9000
Unity will be listening on port 8000 for incoming instructions
For MAC, can use OSCulator to route and convert into the programs you need. can use to see the messages
--Have it listen to channel 8000
Remote IP - address for local host, messages transfered over local ip address
Script object - attached all scripts
private var yRot - changed/incremented whenever the button is pushed
-this is probably what we need to change in order to casue the animations
Update - runs every few frames within unity
-var go - goes and finds the game object (in example, the cube. )
-transfor, rotate around the y axis a certain number of degrees
- every time the button is hit, it increments a certain number of degrees
All message handler - takes any osc message in and decides what to do with it
-var msgstring - takes the entire message and keeps track of it
-message address - breaks that message down just into the variable being sent (in his example, its
-message value - whatever your osc sender is set up to send
-in code, its an on and off switch, off=0, on=1. 1 is the degree we're going to use to "rotate the cube"
-debug prints out the message string
-his message import = /1/push7 1
-assume "7" is the button number, "1" is the on state
switch (msgAddress): for any message that comes in, do these things by default. In the case of the tutorial, default is to Rotate(msgValue)
switch (msgAddress):{
case '/1/push7": //1 being the button on state, and 7 being the button pushed
var rotateVal = msgValue*10 //makes spin 10 times as fast
Rotate(rotateVal);
break;
use cases to seperate movements for different "buttons"
Can call separate functions to perform the functions instead. Eg/ public function NAME(msgValue):void{rotate=msgValue}
What else went well was referencing the Unity forums in order to get a general idea of how to implement the GitHub code into our code.
No comments:
Post a Comment