about
Leoni Voegelin
[c]2020, of all contents: Leoni Voegelin | Impressum
contact: leoni.voegelin[at]gmail.com
instagram
data base
VeraVoegelin
/
vimeo
Friends Of Random Objects
/
WORKSHOP
interacting with the moon
//
install Unity Editor 2021.3.9f or 2021.3.8 in your Unity Hub and start a new project.

Download "Ardity" library by Daniel Wilches from the Unity Asset Store (or: https://ardity.dwilches.com/) and import it to your package manager.

in the assets folder, there will be a SetUp guide, for a first look on how to connect Arduino with Unity. Basically what you need to get Ardity up and running is adding the SerialController script to one of your GameObjects.
By default, Unity uses a subset of the .NET framework. Go to Edit -> Project Settings -> Player, and under "Other Settings" find an option that reads "Api Compatibility Level" and change it from ".NET 2.0 Subset" to ".NET 2.0".

In the SetUp guide you will also find an example code you can run on your Arduino. Try with a simple sensor or a potentiometer if you can get the analog signal in your Unity console.
we want to connect Arduino over Serial with Unity and interact with our lunar landscape
-

-


-






-
Steps:
Demo on what this is all about
create some paperpuppet astronauts with metal feets and trigger sound with them
connect your puppets with Unity and trigger light / sound / change position / etc in the virtual world.
***if you want more outer space feeling, use a breathingbelt to interact with the moon***
1.
2.
3.
documentation
/
On the astronaut puppet we use the feet like pushbuttons which trigger the steps on the moon and a lightsensor (ldr) to trigger sound.

Circuit and wireing:
-


-


















-
ARDUINO
UNITY
To send the messages over Serial to Unity, we separate the the sensordata with a "," so we can parse the messages in individual blocks in our UnityScript.




In Unity, Create a new C# Script and name it something like "MyMessageListener". In there, you will use an array to parse the messages from your Arduino and pass them on to other Scripts you may write and use or wherever you execute your code where you use the data from the UNO.

Here as an example my MessageListener Script, I called it myMessageListenerInput:




As you will notice I, as long as the button is pressed, the boolean "rightStep" is true. To change this, to execute the Step only once and then stop until it is pressed again, you can use an integer to do so:




Another problem is, that I use the data of the light sensor for the volume on my AudioSource. The range of the Volume on the AudioSource is 0-1 but my data is way to high. So I wrote a mapping function to map the input of the light sensor to the smaller range of the AudioSources Volume.

create a new variable (I made mine public)




use it and write your own mapping Function
I refere now directly to my MoveFeet Script to call the Functin IncreaseStep() where I translate the position of my astronaut.
-




-


-







-


-


But I think these are just some details, now you can have fun with your astronaut walking on the moon! If you want to use a first Person camera view, there is a nice tutorial: https://www.youtube.com/watch?v=5Rq8A4H6Nzw
and if you want to now more about movement of your astronaut, you can have a look at this tutorial: https://www.youtube.com/watch?v=CieCJ2mNTXE
-



This is our outcome at METAFORMY Festival :)