luffy-yu / UnityPythonChat

A fake WebRTC based Unity-Python bi-directional communication sample project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnityPythonChat

A fake WebRTC based Unity-Python bi-directional communication sample project.

Scenario

  • Stream camera pose from HoloLens 2 to PC
  • Process the pose data (python-based algorithm)
  • Stream the processed data from PC to HoloLens 2

I tried MixedReality-WebRTC and Unity WebRTC but failed.

It's fake because there's no peer connection.

Implementation

Python side

  • A server acts as the bridge that connects two clients, PC and HoloLens 2.
  • A session will be initialized after one peer is registered and another peer is also registered and calls the former peer.
  • After that, two peers exchange data by sending message that starts with DATA.
    • client.py Line 66 - 68
    • BiDirectionalChat.cs Line 69, and Line 110

Unity side

  • IDs of two peers are fixed, you may change as you wish.

How to run

  • Run python server
  • Run python client
  • Run Unity

About

A fake WebRTC based Unity-Python bi-directional communication sample project.

License:MIT License


Languages

Language:Python 87.1%Language:C# 12.9%