AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
BulletController.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 
6 namespace HoloToolkit.Unity.SharingWithUNET
7 {
11  public class BulletController : MonoBehaviour
12  {
13  private void Start()
14  {
15  // The bullet's transform should be in local space to the Shared Anchor.
16  // Make the shared anchor the parent, but we don't want the transform to try
17  // to 'preserve' the position, so we set false in SetParent.
18  transform.SetParent(SharedCollection.Instance.transform, false);
19 
20  // The rigid body has a velocity that needs to be transformed into
21  // the shared coordinate system.
22  Rigidbody rb = GetComponentInChildren<Rigidbody>();
23  rb.velocity = transform.parent.TransformDirection(rb.velocity);
24  }
25  }
26 }
This script exists as a stub to allow other scripts to find the shared world anchor transform...
Controls little bullets fired into the world.