1

For a project at my university I need to create a Unity3D application on my laptop, in which the camera is stationairy and can be controlled to rotate in any direction using the gyroscope of my Android smartphone (Nexus 5), wirelessly or through usbcable.

I've looked at the possibility of OSC or the Unity Remote 5 App, but up till now haven't found a way that works in order to obtain this result.

Any help or advice would be hugely appreciated - I don't have much experience yet with all this.

Thanks!

2 Answers2

0

If i was going to do this then I would use UNET (Unitys built in multiplayer networking API) and have the rotation sync over LAN.

On the camera I would have a Network Transform and a script to control its rotation based on accelerometer input.

The version on the phone would be the authority and sync it's rotation over the network to the client on the laptop.

Pros: Wireless, fast (over wifi), very little code required to make it work, lots of documentation available online.

Cons: Relies totally on your network situation, you will have to do a lot of trial and error to get a smooth experience (not jerky) i think.

As for getting the tilt input on the device, Unity have a great tutorial here: https://unity3d.com/learn/tutorials/topics/mobile-touch/accelerometer-input

It's pretty straight forward.

Sound like a fun project, good luck!

turnipinrut
  • 614
  • 4
  • 12
0

It's possible to do this via cable, WiFi, Bluetooth 2.0 or Bluetooth 4.0 (BLE). I have implemented what you need in WiFi and Bluetooth 2.0 for my current work.

It's pretty easy to get rotation values and stream them from Android but I don't think you will need to do anything because you can just use this! https://play.google.com/store/apps/details?id=de.lorenz_fenster.sensorstreamgps&hl=en

So the question is how do you receive the data this is sending on Unity's side. The answer is the UdpClient class.

If you need more reliability because every second student in your uni library is torrenting Mr. Robot and your getting huge lag then I can tell you how to implement the same thing in Bluetooth, which is not super trivial as .NET 2.0 (which unity uses) doesn't support bluetooth libraries, but there are solutions...

slaw
  • 611
  • 2
  • 7
  • 20