Introduction
We have been exploring Hololens in terms of Direct X usage (trust me there is lot to cover when we go back to Direct X) now we will change focus to Unity. The structuring of an app is similar to adding game objects in the Unity scene and then we take it forward using Holographic features.
The ground rules of development
Relax and follow how you have been developing apps for Unity on a long term basis and you don't have to do a fancy thing that is out of the blue. When you are developing for Hololens, you will have to keep a tap and the build should be targeted for UWP.
Things that are required
- Unity Microsoft Hololens technical review.
- UWP tools for Unity technical review.
- Visual Studio 2015 Update 2.







- using UnityEngine;
- using System.Collections;
- public class Rotate: MonoBehaviour {
- // Use this for initialization
- void Start() {}
- // Update is called once per frame
- void Update() {
- // Rotate the object around its local Y axis at 1 degree per second
- transform.Rotate(Vector3.right * Time.deltaTime);
- // ...also rotate around the World's Y axis
- transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
- }
- }


- using UnityEngine;
- using System.Collections;
- public class WorldCursor: MonoBehaviour {
- private MeshRenderer meshRenderer;
- // Use this for initialization
- void Start() {
- // Grab the mesh renderer that's on the same object as this script.
- meshRenderer = this.gameObject.GetComponentInChildren < MeshRenderer > ();
- }
- // Update is called once per frame
- void Update() {
- // Do a raycast into the world based on the user's
- // head position and orientation.
- var headPosition = Camera.main.transform.position;
- var gazeDirection = Camera.main.transform.forward;
- RaycastHit hitInfo;
- if (Physics.Raycast(headPosition, gazeDirection, out hitInfo)) {
- // If the raycast hit a hologram...
- // Display the cursor mesh.
- meshRenderer.enabled = true;
- // Move the cursor to the point where the raycast hit.
- this.transform.position = hitInfo.point;
- // Rotate the cursor to hug the surface of the hologram.
- this.transform.rotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
- } else {
- // If the raycast did not hit a hologram, hide the cursor mesh.
- meshRenderer.enabled = false;
- }
- }
- }







Ritadrik ChowdhuryPosted Jul 17, 2018, 12:30 AM
Hi Manisha, Thanks for this tutorial and I'm gonna develop my first hologram app... now my question is, is it possible to develop this app without having holo-lens?
Prasanna MuraliPosted May 20, 2016, 11:54 AM
Nice one...
Pradeep SahooPosted May 19, 2016, 10:23 AM
Good share .......Thanks for sharing ....
Vignesh ManiPosted May 4, 2016, 4:27 PM
Good one
Debasis SahaPosted May 4, 2016, 10:20 AM
Nice One..
NitinPosted May 4, 2016, 7:41 AM
Thanks for sharing
Mohammed IbrahimPosted May 4, 2016, 4:02 AM
nice
Kuppurasu NagarajPosted May 3, 2016, 9:44 PM
Nice Sharing...
Mahesh ChandPosted May 3, 2016, 9:37 PM
Nice Manisha. Quick feedback on images. You can cut out the part that is focus instead of posting large images. Cheers!
Bhavik PatelPosted May 3, 2016, 9:33 PM
nice article. will UWP app works in hololens?
Ibrahim ErsoyPosted May 3, 2016, 3:44 PM
Thats nice! Keep those articles coming.Thank you