Unreal Journey 6: Interaction
Creating an interactive scene is crucial for immersive experiences, so my goal is to implement smartphone-controlled interaction within Unreal Engine. This involves using Zigsim for iOS to capture Quaternion x, y, and z values from my iPhone, sending these values via OSC (Open Sound Control) to my Unreal project, and building a Blueprint to read these values and control the rotation of a 3D object.
Setting Up Zigsim
First, I set up Zigsim on my iPhone. It’s essential to choose the correct sensors in the app and configure it to send data to the IP address of the computer running Unreal Engine. The port number must also be correctly set—in my case, it’s 8000.
Working with Blueprints
The next step was integrating the OSC data into Unreal Engine using Blueprints. This process was more complex than anticipated, especially figuring out how to read the OSC data and split it into three separate variables for x, y, and z.
Receiving OSC Data
To extract the Quaternion values from the OSC message, I used the „Get OSC Message Floats“ node. This node retrieves all float values from the received OSC message as a float array. To isolate the first three values (representing x, y, and z), I employed three „GET (a copy)“ nodes, indexed at 0, 1, and 2. These values were then stored in variables OSC X, OSC Y, and OSC Z.
Implementing Rotation Logic
Next, I created another Blueprint to manage the 3D object’s rotation. This Blueprint included the mesh of the object and an event graph to handle the rotation logic. I introduced a custom event, „SetRotation,“ with three float parameters: Rot X, Rot Y, and Rot Z, which received values from the previous Blueprint. These parameters were fed into a „Make Rotator“ node to control the self-rotation of the actor.
Fine-Tuning and Testing
The final step involved fine-tuning the rotation values and adjusting the axes to ensure natural movement. This required several iterations to get the interaction feeling intuitive and responsive.
Conclusion
Implementing smartphone-controlled interaction in Unreal Engine was a challenging but rewarding experience. By leveraging Zigsim and OSC, I could create a dynamic and interactive scene that adds significant depth to the project. The complexity of setting up Blueprints to handle real-time data highlights the flexibility and power of Unreal Engine in creating interactive environments. I am very excited to die deeper into this Interaction methods in the future!