void Start() { networkAnchor = GetComponent <NetworkAnchor>(); networkAnchor.ReceivedRemoteAnchorTransferBatch += NetworkAnchor_ReceivedRemoteAnchorTransferBatch; persistence = GetComponent <AnchorPersistence>(); persistence.TargetGameObject = TargetTransform.gameObject; persistence.AnchorPersistenceEvent += Persistence_AnchorPersistenceEvent; }
private void BindETV(NetworkAnchor networkAnchor) { currentlyBoundETV = networkAnchor.ETV.gameObject; positionAtTimeOfBinding = currentlyBoundETV.transform.position; rotationAtTimeOfBinding = currentlyBoundETV.GetComponent <ETVAnchor>().Rotatable.transform.localRotation; currentlyBoundNetworkAnchor = networkAnchor.gameObject; currentlyBoundNetworkAnchor.GetComponent <BoxCollider>().enabled = false; // Disable the visualization in HoloLens and align it with pETV Debug.Log("Collision detected"); //otherAnchor.VisAnchor.SetActive(false); currentlyBoundETV.transform.parent = Anchor.transform; currentlyBoundETV.layer = LayerMask.NameToLayer("Invisible"); foreach (var t in currentlyBoundETV.transform.GetComponentsInChildren <Transform>()) { t.gameObject.layer = 9; } currentlyBoundETV.transform.localPosition = new Vector3(1.75f, 1.75f, .5f); currentlyBoundETV.transform.localRotation = Quaternion.identity; currentlyBoundETV.GetComponent <ETVAnchor>().Rotatable.transform.localRotation = Quaternion.identity; }
private void NetworkAnchor_ReceivedRemoteAnchorTransferBatch(NetworkAnchor sender, WorldAnchorTransferBatch batch) { persistence.ApplyAnchor(batch, true); }