Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*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