// Handles OSC messages private static void messageReceived(object sender, OscMessageReceivedEventArgs oscMessageReceivedEventArgs) { OscMessage message = oscMessageReceivedEventArgs.Message; // Read the address part by part string[] address = message.Address.TrimStart('/').Split('/'); // For the type of the message switch (address[1]) { case "transform": if (_holoLens.ContainsKey(address[0])) { HoloLensTracker holoLens = _holoLens[address[0]]; holoLens.transformData.translate = new Vector3((float)message.Data[0], (float)message.Data[1], (float)message.Data[2]); holoLens.transformData.rotate = new Quaternion((float)message.Data[3], (float)message.Data[4], (float)message.Data[5], (float)message.Data[6]); } break; case "input": // No way to currently handle input break; } }
/// <summary> /// Registers a holoLens tracker for the master node. /// </summary> /// <param name="tracker">The holoLens tracker of the master.</param> public void RegisterHoloLensTracker(HoloLensTracker tracker) { // Create the reciever and dictionary if there is none if (_reciever == null) { _reciever = new OSCReciever(); _reciever.Open(holoPort); _holoTrackerFromID = new Dictionary <string, HoloLensTracker>(); } // add tracker to dictionary _holoTrackerFromID.Add(tracker.displayID, tracker); }