Skip to content

Wave-Unity-Library/Motion-Mapping

Repository files navigation

alt tag

Wave: A Unity Asset Library

We want mobile gaming to be a more immersive and interactive experience, so we designed Wave. It's an open source Unity game engine Asset that makes 2 game dev features tremendously more accessible: elements of motion tracking for character control and real-time audio streaming between multiple devices. Check out a 2-minute demo video here.

Table of Contents

Prerequisites
Getting Started
Gyroscopic Camera Controller
Translational Movement with Accelerometer
Real Time Audio
Assets Directory
Contribute
Team

Prerequisites

Getting Started

Setting up Unity Remote

To use a phone with the Unity editor, * Download Unity Remote 4 from the app store. * In the Unity editor menubar, visit Edit > Project settings > Editor. * Under Unity Remote, change the tab pulldown to match your mobile device. iPhones are good to go! * Android users -- you still have more to configure for unity remote. Find any of the tutorials on google.

Environment Configuration

* Fork the repo, and navigate to the Assets/Scripts directory of the master branch. * Select the appropriate files. For example, cameraController.js for the gyroscopic camera features. * Include them within the Assets folder of your Unity library.

Gyroscopic Camera Controller

![alt tag](http://res.cloudinary.com/jjcodepen/image/upload/v1468705961/GyroscopeController_mu7qac.gif) In the GIF above, we're setting up an environment to use a mobile phone's gyroscope to control the in-game camera. Get started by following the steps below: * All logic is located inside the cameraController.js script. Make sure it's within the Assets folder of your Unity library. * Select the Main Camera object in your scene. * Add our Camera Controller script as a component in the inspector panel. * Drag a player object into the Camera Controller component.

Translational Movement with Accelerometer

![alt tag](http://res.cloudinary.com/jjcodepen/image/upload/v1469215988/Accelerometer_oh2uj8.gif) The idea of this feature is that when you move in the physical world, your in-game character moves as well. Using information from the mobile phone's accelerometer, we attempt to simulate walking movements in the Unity game engine. It's still experimental, but it works and may require tweaking depending on the mobile phone. Get started by following the steps below: * All logic is located inside the playerController.js script. Make sure it's within the Assets folder of your Unity library. * Select the Player object in your scene. * Add our Player Controller script as a component in the inspector panel. * Drag a player object into the Camera Controller component.

Real-Time Audio

Allows you to talk with your mates by providing a way to transmit your voice across a multiplayer network.

To get started you'll want to add the following things to any game object you want to be able to talk in real-time:

  • AudioSource object
  • VoiceController.cs

alt tag

Currently, our audio feature is configured to only work with Unity's networking through their HLAPI and was written with Unity 5 in mind. To see an example of this feature being used with the HLAPI check out the 'demo' branch of this repository.

Configurable Options:

  • Compression (defaults to Zlib)
  • Recording Frequency (defaults to 16000Hz)
  • Packet Sizes ...everything really

We provide multiple compression options such as: Zlib, Opus, NSpeex, and Snappy.

alt tag

It's easy to adjust any of the settings you desire for your game. Just go to the VoiceController.cs script and change the variables at the top of the file. For example, if you want to record at higher frequencies, then just change the recordFrequency variable.

Assets Directory Structure and Descriptions

| Name | Description | | ------------------------------------------ | ----------------------------------------------------------------- | | Scripts/CameraController.js | Use the phone's gyroscope to control the in-game camera. | | Scripts/PlayerController.js | Use the phone's accelerometer to guide in-game movement. | | Scripts/VoiceController.cs | Facilitates real-time voice chat. | | Scripts/VoiceUtils.cs | Various compression and typecasting methods for audio info. | | Scripts/VoiceCompression.cs | Provides a list of audio codecs used in VoiceSettings.cs. | | Scripts/VoiceSettings.cs | Edit this file to select and implement different codecs. | | Scripts/CircularBuffer.cs | Used to prevent dynamic memory allocation when sending audio data.| | Plugins/Ionic.Zlib.dll | Codec for Zlib audio compression and decompression. | | Plugins/NSpeex.dll | Codec for Nspeex audio compression and decompression. | | Plugins/Snappy | Codec for Snappy audio compression and decompression. |

Contribute

If anything is at all unintuitive or unclear, please feel free to reach out. We'd love to incorporate any feedback from the community, especially given that this is an open source project. This is very much a continual work in progress, and we're constantly adding functionality.

Our Team

* Jessica Ayunani - github.com/jayunani * Michael Laythe - github.com/mlaythe * Jeremy Yip - github.com/jeyip

About

Open-source Unity asset library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published