Myo + Oculus Rift Tutorial

Slides:



Advertisements
Similar presentations
Re-making a Classic in VR Chris #SydVR.
Advertisements

GameCamp! and Game Davis Introduction to Unity®
GameCamp! and Game Davis Creating a 2D Platformer in Unity.
GameCamp! and Game Davis Introduction to Scripting in Unity®
HELLO WORLD: YOUR FIRST PROGRAM CHAPTER Topics  Hello World?  Creating a Unity Project –The Unity Project Folder  MonoDevelop: Unity's Code Editor.
Based on Roll-a-ball video tutorial from Unity Technologies Part WakeUpAndCode.com.
Unity 3D game IDE 1.  Unity is a multi-platform, integrated IDE for scripting games, and working with 3D virtual worlds  Including:  Game engine ▪
UFCEKU-20-3Web Games Programming Unity 3D Basic Concepts Using and Creating Prefabs.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
SE 350 – Programming Games Lecture 7: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
Web Games Programming An Introduction to Unity 3D.
Web Games Programming Unity Scripting Fundamentals.
UFCFS D Technologies for the Web Unity 3D: Review of Topics and Related Concepts.
CSE 381 – Advanced Game Programming Code Setup.
Unity 5 Visual Studio Code * Asset Store * FPS * Terrain.
SE 320 – Introduction to Game Development Lecture 3: Unity’s Interface and Concepts Lecturer: Gazihan Alankuş Please look at the last two slides for assignments.
SE 320 – Introduction to Game Development Lecture 7: Programming Lecturer: Gazihan Alankuş Please look at the last two slides for assignments (marked with.
Yingcai Xiao Game Development Intro to Unreal Engine.
UFCEK-20-3Web Games Programming Unity 3D: Review of Topics Publishing for the Web.
LESSON #10: Digital Playtesting & Introduction to Character Animation with Mecanim DGMD E-70 Principles of Game Design.
CLASSES CHAPTER Topics  Understanding Classes –The Anatomy of a Class  Class Inheritance –Superclasses and Subclasses –Virtual and Override 2.
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
UFCEKU-20-3Web Games Programming Instantiating World Objects.
UFCFSU-30-13D Technologies for the Web An Introduction to Unity 3D.
Expressive Intelligence Studio // Center for Games and Playable Media // Unity Pro John Murray Expressive.
Cosc 5/4735 Unity 3D Getting Started Guide for Android.
 How can we find/refer to objects at runtime?  This must be dynamic because objects may come and go.  How can we solve this problem?
Yingcai Xiao Game Development with Unity3D Inside/Outside Unity3D.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Behavior trees & The C# programming language for Java programmers
Game Development with Unity3D
EEC-693/793 Applied Computer Vision with Depth Cameras
Quick Intro to Unity Lecture 2.
Game Development with Unity3D Inside/Outside Unity3D
First Person Shooter Project
More (C#) Scripting Day 2, Lesson 1.
Sai Goud Durgappagari Dr. Yingcai Xiao
EEC-693/793 Applied Computer Vision with Depth Cameras
ROBOTC for VEX Online Professional Development
DGMD E-70 Principles of Game Design
Dystopia game Amjd , Iyad , Haytham.
Requirements & Verification
Character Selection from a lobby in Unity
Introduction to Events
EEC-693/793 Applied Computer Vision with Depth Cameras
Sai Goud Durgappagari, VIJAY KOLAGANI, Dr. Yingcai Xiao
Out of this World A VR Experience brought to you by Team WFF:
Results and Conclusions
Vijay Kumar Kolagani Dr. Yingcai Xiao
lecture 8 Our First Project
UNITY TEAM PROJECT TOPICS: [1]. Unity Collaborate
Oculus Rift DK2 + Leap Motion Unity Tutorial
Game Development Intro to Unreal Engine
A Prime Example of HCI Application
lecture 7 Our First Project
Arrays
A beginner’s tutorial for Unity and VR
Week 6: Time and triggers!
In this chapter, you will learn the following:
Fundaments of Game Design
Kinetic Painting VR application
EEC-693/793 Applied Computer Vision with Depth Cameras
Unity Game Development
Unity Game Development
Unity Game Development
Unity Game Development
Unity Game Development
Unity Game Development
Presentation transcript:

Myo + Oculus Rift Tutorial Chris Zaharia @chrisjz

Download the game at chrisjz.github.io/myogic Content Develop simple mage game in virtual reality Shoot magic projectiles using hand gestures Aim by rotating arm Defeat hoard of spiders Download the game at chrisjz.github.io/myogic

Myo Dev Kit EMG sensors for gesture detection Gyroscope Accelerometer Magnetometer Bluetooth Full day battery charge Download link to Myogic alpha version: https://www.dropbox.com/s/f255fdzd8zgtliv/myogic-alpha.zip?dl=0

Myo Dev Kit vs Leap Motion MDK Leap Motion Fixed gestures (six) 2D arm tracking Wireless Finger tracking 3D hand tracking HMD Mountable Myo developers did mention that a future release would provide developers with raw EMG data which will open up possibilities for many more gestures.

Wireless VR Why Myo? Allows for wireless VR with motion controls I.e. Gear VR + Myo

Requirements IDE Myo Rift DK2 Unity Pro 4.6+ Myo Connect 0.7.0+ (Win/Mac) SDK Beta 7+ (Win/Mac) Rift DK2 Unity 4 Integration 0.4.4+ Unity package is included in the SDK.

Scope Integrate Oculus VR player into game scene Attach Myo controller to arm-hand model Map several magic attacks to hand gestures

Download the game at chrisjz.github.io/myogic Getting Started Download the source code for Myogic at github.com/chrisjz/myogic Create a folder in the Assets directory called TutorialScenes. Copy the scene and corresponding folder from Palace of Orinthalian > [Scenes] to TutorialScenes. Open the copied scene. Download the game at chrisjz.github.io/myogic

Create OVR Player Add the OVRPlayerController prefab into the root [Character] gameobject. Disable the existing First Person Controller gameobject. Feel free to place the player anywhere in the scene. OVRPlayerController prefab is located at OVR > Prefabs.

Hand Model Positioning In the gameobject OVRCameraRig create the gameobjects Hands > Right. Place the prefab GlowRobotFullRightHand in Right and position it on the right of the player’s view. Set scale of the right hand to 5x5x5. GlowRobotFullRightHand prefab is located in LeapMotion > Prefabs > HandGraphics.

Integrate Myo Controls with Hand Place the Hub – 1 Myo prefab in the root of the hierarchy. Attach the script JointOrientation to the OVRCameraRig > Hands > Right gameobject. Drag the Myo gameobject into the Myo variable in the JointOrientation script. The JointOrientation script will map Myo’s gyroscope based movements to the arm model. Hub – 1 Myo prefab is located in Myo > Prefabs. The bug fix though has a setback where the player won’t be able to rotate and can only move forwards, backwards and strafe sideways. Bug fix: Set Rotation Amount to 0 in OVRPlayerController as JointOrientation has an existing bug where the arm rotates incorrectly when the player rotates.

Setup Magic Powers Create a Plane object under Right gameobject and position in front of the hand model’s index finger. Name the plane object MagicLauncher and disable its Mesh Collider and Mesh Renderer and ensure its X axis faces forward from finger. Attach a new C# script called MagicController on Right gameobject. Resize the plane to the dimensions of a finger to make it easier to place it.

MagicController.cs (1) using UnityEngine; using System.Collections; using Pose = Thalmic.Myo.Pose; public class MagicController : MonoBehaviour { // Myo game object to connect with. // This object must have a ThalmicMyo script attached. public GameObject myo = null; // Point from where magic projectiles will launch from the hand. // This object must be a plane placed either in front of the palm or at the tip of the hand's fingers. public GameObject handMagicLauncher; public GameObject fistProjectile; public GameObject waveInProjectile; public GameObject waveOutProjectile; // Speed of projectile public float fistSpeed = 1000; public float waveInSpeed = 1000; public float waveOutSpeed = 1000; // Cooldown until next projectile can be launched public float projectileCooldown = 1; protected ThalmicMyo myoController = null; private float projectileTimer = 0; Setup variables for the scene’s myo object, the hand magic launcher and the projectile attributes that map to the 3 used myo gestures.

MagicController.cs (2) void Start () { myoController = myo.GetComponent<ThalmicMyo> (); } void Update () { if (!myo && !myoController) return; if (projectileTimer > 0) { projectileTimer -= Time.deltaTime; } else { projectileTimer = projectileCooldown; switch (myoController.pose) { case Pose.Fist: Attack (fistProjectile, fistSpeed); break; case Pose.WaveIn: Attack (waveInProjectile, waveInSpeed); case Pose.WaveOut: Attack (waveOutProjectile, waveOutSpeed); Projectiles will have a cooldown before they are re-launched, which you can set with the public variable projectileCooldown. The Attack function will be called based on which of the 3 myo gestures are detected, with the magic projectile object (a prefab we will set soon) and the speed of the projectile passed into this object.

MagicController.cs (3) protected void Attack(GameObject projectilePrefab, float speed) { GameObject projectile; projectile = (GameObject) Instantiate (projectilePrefab.gameObject, handMagicLauncher.transform.position, Quaternion.identity); projectile.rigidbody.AddForce (handMagicLauncher.gameObject.transform.forward * speed); } The Attack method handles all the magic shooting itself. An instance of the projectile object will be created at the position of the MagicLauncher object we positioned in front of the hand earlier. The Quaternion.identity parameter will ensure the projectile faces the default X axis direction. Now we will throw the projectile by adding force in the forward direction of the handMagicLauncher at the projectile’s defined speed.

Set Magic Public Variables In the MagicController script, set the following for the public variables: Myo – Drop in the scene’s Myo object. HandMagicLauncher – Drop the MagicLauncher object under the Right gameobject. “—” Projectiles – Set as any of the projectile prefabs in Projectiles > Prefabs. Optionally you can also change the speed of each projectile and the cooldown period.

Extras Add enemy spiders to the scene from Enemies > Spider > Prefabs and play around with its health, speed, FOV, size etc. Add new magic attacks and change their attributes. Add player health and damage to make the game more challenging. For new magic projectiles, you can find more in KY_magicEffectsFree > prefab. Just make sure you add a rigidbody, collider and at least the MagicProjectile.cs script. See the existing projectile prefabs in Projectiles > Prefabs for guidance. When playing the game, you can re-calibrate the arm’s position by pressing the “r” key or doing the fingers spread gesture. There are currently no scripts to add health and damage to the player, this is for you to figure out!

Good Luck!