Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created February 2, 2017 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/be76818631aa133e7810764717b4736a to your computer and use it in GitHub Desktop.
Save flushpot1125/be76818631aa133e7810764717b4736a to your computer and use it in GitHub Desktop.
/*copied from complete version in sample project of "https://developer.microsoft.com/en-us/windows/holographic/holograms_210"*/
using Academy.HoloToolkit.Unity;
using UnityEngine;
/// <summary>
/// InteractibleAction performs custom actions when you gaze at the holograms.
/// </summary>
public class InteractibleAction : MonoBehaviour
{
[Tooltip("Drag the Tagalong prefab asset you want to display.")]
public GameObject ObjectToTagAlong;
void PerformTagAlong()
{
if (ObjectToTagAlong == null)
{
return;
}
// Recommend having only one tagalong.
GameObject existingTagAlong = GameObject.FindGameObjectWithTag("TagAlong");
if (existingTagAlong != null)
{
return;
}
GameObject instantiatedObjectToTagAlong = GameObject.Instantiate(ObjectToTagAlong);
instantiatedObjectToTagAlong.SetActive(true);
/* TODO: DEVELOPER CODING EXERCISE 6.b */
// 6.b: AddComponent Billboard to instantiatedObjectToTagAlong.
// So it's always facing the user as they move.
instantiatedObjectToTagAlong.AddComponent<Billboard>();
// 6.b: AddComponent SimpleTagalong to instantiatedObjectToTagAlong.
// So it's always following the user as they move.
instantiatedObjectToTagAlong.AddComponent<SimpleTagalong>();
// 6.b: Set any public properties you wish to experiment with.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment