// invoked by UserAnchorRemoved-event private void UserAnchorRemoved(ARUserAnchor anchor) { if (!arManager) { return; } MultiARInterop.MultiARData arData = arManager.GetARData(); if (arData.allAnchorsDict.ContainsKey(anchor.identifier)) { List <GameObject> anchoredObjs = arData.allAnchorsDict[anchor.identifier]; arData.allAnchorsDict.Remove(anchor.identifier); foreach (GameObject anchoredObj in anchoredObjs) { if (anchoredObj && anchoredObj.transform.parent) { GameObject parentObj = anchoredObj.transform.parent.gameObject; anchoredObj.transform.parent = null; anchoredObj.SetActive(false); Destroy(parentObj); } } Debug.Log("Anchor removed: " + anchor.identifier); } }
void UnityARSessionNativeInterface_ARUserAnchorUpdatedEvent(ARUserAnchor anchorData) { modelInstance.transform.position = UnityARMatrixOps.GetPosition(anchorData.transform); modelInstance.transform.rotation = UnityARMatrixOps.GetRotation(anchorData.transform); Debug.LogFormat("Updated anchor: {0} | {1}", anchorData.identifier, modelInstance.transform.position.ToString("F2")); }
public void UpdateUserAnchor(ARUserAnchor arUserAnchor) { //Debug.Log("ARKitBridge: UpdateUserAnchor: arUserAnchor: " + arUserAnchor); userAnchor = arUserAnchor; SendEventData("UpdateUserAnchor"); }
public void ExampleAddAnchor(ARUserAnchor anchor) { if (m_Clones.Contains(anchor.identifier)) { Console.WriteLine("Our anchor was added!"); } }
public void RemoveUserAnchor(ARUserAnchor arUserAnchor) { //Debug.Log("ARKitBridge: RemoveUserAnchor: arUserAnchor: " + arUserAnchor); userAnchor = arUserAnchor; SendEventData("RemoveUserAnchor"); }
private static void WAnchorAdd(ARUserAnchor anchor) { Logger.log(Logger.Type.Info, "WAnchorAdd"); if (!tracking) { Logger.log(Logger.Type.Info, "tracking paused. Ignore."); return; } if (!anchors.Add(anchor.identifier)) { Logger.log(Logger.Type.Warning, "anchor was already added: {0}", anchor.identifier); return; } if (WAnchorAdded == null) { Logger.log(Logger.Type.Info, "no delegates for this event."); return; } Logger.log(Logger.Type.Info, "dispatch event."); WAnchor a = new WAnchor(anchor.identifier, UnityARMatrixOps.GetPose(anchor.transform)); WAnchorAdded(a); }
private static void WAnchorUpdate(ARUserAnchor anchor) { Logger.log(Logger.Type.Info, "WAnchorUpdate"); if (!tracking) { Logger.log(Logger.Type.Info, "tracking paused. Ignore."); return; } if (!anchors.Contains(anchor.identifier)) { Logger.log(Logger.Type.Warning, "=> WAnchorAdd (tracking was probably off and just turned on)."); WAnchorAdd(anchor); return; } if (WAnchorUpdated == null) { Logger.log(Logger.Type.Info, "no delegates for this event."); return; } Logger.log(Logger.Type.Info, "dispatch event."); WAnchor a = new WAnchor(anchor.identifier, UnityARMatrixOps.GetPose(anchor.transform)); WAnchorUpdated(a); }
void Spawn(ARUserAnchor userAnchor) { var position = UnityARMatrixOps.GetPosition(userAnchor.transform); var rotation = UnityARMatrixOps.GetRotation(userAnchor.transform); Instantiate(prefab, position, rotation); }
public void ExampleAddAnchor(ARUserAnchor anchor) { if (m_Clones.Contains(anchor.identifier)) { Debug.Log("Our anchor was added!"); } }
public void AnchorRemoved(ARUserAnchor anchor) { if (anchor.identifier.Equals(m_AnchorId)) { UnityEngine.Object.Destroy(base.gameObject); } }
public void AnchorRemoved(ARUserAnchor anchor) { if (m_Clones.Contains(anchor.identifier)) { m_Clones.Remove(anchor.identifier); Debug.Log("AnchorRemovedExample: " + anchor.identifier); } }
public void AnchorRemoved(ARUserAnchor anchor) { if (m_Clones.Contains(anchor.identifier)) { m_Clones.Remove(anchor.identifier); Console.WriteLine("AnchorRemovedExample: " + anchor.identifier); } }
void UnityARSessionNativeInterface_ARUserAnchorRemovedEvent(ARUserAnchor anchorData) { Transform child = GetChildForAnchorId(anchorData.identifier); child.gameObject.SetActive(false); Debug.LogFormat("Removed anchor: {0} | {1}", anchorData.identifier, child.position.ToString("F2")); }
void UnityARSessionNativeInterface_ARUserAnchorUpdatedEvent(ARUserAnchor anchorData) { Transform child = GetChildForAnchorId(anchorData.identifier); child.position = UnityARMatrixOps.GetPosition(anchorData.transform); child.rotation = UnityARMatrixOps.GetRotation(anchorData.transform); Debug.LogFormat("Updated anchor: {0} | {1}", anchorData.identifier, child.position.ToString("F2")); }
private void UpdateUserAnchor(ARUserAnchor _userAnchor) { ARKAnchor anchor; if (m_anchors.TryGetValue(_userAnchor.identifier, out anchor)) { anchor.transform.position = _userAnchor.transform.GetColumn(3); anchor.transform.rotation = _userAnchor.transform.rotation; } }
private void UpdateUserAnchor(ARUserAnchor anchorData) { ARAnchor anchor; if (m_Anchors.TryGetValue(anchorData.identifier, out anchor)) { anchor.transform.position = anchorData.transform.GetColumn(3); anchor.transform.rotation = anchorData.transform.rotation; } }
private void UserAnchorRemoved(ARUserAnchor anchor) { if (_userAnchors.ContainsKey(anchor.identifier)) { _userAnchors.Remove(anchor.identifier); } if (_anchoredGameObjects.ContainsKey(anchor.identifier)) { _anchoredGameObjects.Remove(anchor.identifier); } }
void UnityARSessionNativeInterface_ARUserAnchorAddedEvent(ARUserAnchor anchorData) { Transform child = GetChildForAnchorId(anchorData.identifier); child.position = UnityARMatrixOps.GetPosition(anchorData.transform); child.rotation = UnityARMatrixOps.GetRotation(anchorData.transform); child.localScale = new Vector3(PlayerPrefs.GetFloat(GlobalMapManager.Instance.GetPlayerPrefScaleXKey(anchorData.identifier)), PlayerPrefs.GetFloat(GlobalMapManager.Instance.GetPlayerPrefScaleYKey(anchorData.identifier)), PlayerPrefs.GetFloat(GlobalMapManager.Instance.GetPlayerPrefScaleZKey(anchorData.identifier))); child.gameObject.SetActive(true); Debug.LogFormat("Added anchor: {0} | {1}", anchorData.identifier, child.position.ToString("F2")); }
private void UserAnchorAdded(ARUserAnchor anchor) { if (!_userAnchors.ContainsKey(anchor.identifier)) { _userAnchors.Add(anchor.identifier, anchor); } if (_anchoredGameObjects.ContainsKey(anchor.identifier)) { _anchoredGameObjects[anchor.identifier].transform.position = UnityARMatrixOps.GetPosition(anchor.transform); _anchoredGameObjects[anchor.identifier].transform.rotation = UnityARMatrixOps.GetRotation(anchor.transform); } }
void Spawn(ARUserAnchor userAnchor) { var position = UnityARMatrixOps.GetPosition(userAnchor.transform); var rotation = UnityARMatrixOps.GetRotation(userAnchor.transform); if (placedObj) { placedObj.transform.position = position; Debug.Log("オブジェクト移動"); } else { Debug.Log("初回配置"); placedObj = Instantiate(prefab, position, rotation); } }
void UnityARSessionNativeInterface_ARUserAnchorAddedEvent(ARUserAnchor anchorData) { modelInstance.transform.position = UnityARMatrixOps.GetPosition(anchorData.transform); modelInstance.transform.rotation = UnityARMatrixOps.GetRotation(anchorData.transform); Debug.LogFormat("Added anchor: {0} | {1}", anchorData.identifier, modelInstance.transform.position.ToString("F2")); if (PlayerPrefs.HasKey(playerPrefScaleXKey) && PlayerPrefs.HasKey(playerPrefScaleYKey) && PlayerPrefs.HasKey(playerPrefScaleZKey)) { modelInstance.transform.localScale = new Vector3(PlayerPrefs.GetFloat(playerPrefScaleXKey), PlayerPrefs.GetFloat(playerPrefScaleYKey), PlayerPrefs.GetFloat(playerPrefScaleZKey)); } // TODO modelInstance.SetActive(true); referenceImage.SetActive(false); }
void UnityARSessionNativeInterface_ARUserAnchorAddedEvent(ARUserAnchor anchorData) { // TODO: FIX ALL THIS SHIT. AnchoringFound = true; moveDeviceUI.SetActive(false); Transform child = GetChildForAnchorId(anchorData.identifier); child.position = UnityARMatrixOps.GetPosition(anchorData.transform); child.rotation = UnityARMatrixOps.GetRotation(anchorData.transform); child.localScale = new Vector3(PlayerPrefs.GetFloat(GlobalMapManager.Instance.GetPlayerPrefScaleXKey(anchorData.identifier)), PlayerPrefs.GetFloat(GlobalMapManager.Instance.GetPlayerPrefScaleYKey(anchorData.identifier)), PlayerPrefs.GetFloat(GlobalMapManager.Instance.GetPlayerPrefScaleZKey(anchorData.identifier))); // Fade in newly placed model FadeInModel(child); child.gameObject.SetActive(true); Debug.LogFormat("Added anchor: {0} | {1}", anchorData.identifier, child.position.ToString("F2")); }
private static void WAnchorRemove(ARUserAnchor anchor) { Logger.log(Logger.Type.Error, "WAnchorRemove not implemented"); }
void UnityARSessionNativeInterface_ARUserAnchorAddedEvent(ARUserAnchor anchorData) { // Hide anchoring canvas now that anchoring is achieved anchoringUI.FadeOut(); }
/* This is an example of how to tie a function to an AR event * ExampleAddAnchor is called after an anchor is added to the AR scene * The subscribing to an event part happens in Awake() */ public void ExampleAddAnchor(ARUserAnchor anchor) { Debug.Log("Our anchor was added!"); }
// invoked by UserAnchorAdded-event private void UserAnchorAdded(ARUserAnchor anchor) { Debug.Log("Anchor added: " + anchor.identifier); }
void UnityARSessionNativeInterface_ARUserAnchorRemovedEvent(ARUserAnchor anchorData) { modelInstance.SetActive(false); Debug.LogFormat("Removed anchor: {0} | {1}", anchorData.identifier, modelInstance.transform.position.ToString("F2")); }
void UnityARSessionNativeInterface_ARUserAnchorAddedEvent(ARUserAnchor anchorData) { // Show tracker instrutions/text trackerInfo.SetActive(true); }
private void GameObjectAnchorUpdated(ARUserAnchor anchor) { }
/* This is an example of how to tie a function to an AR event * AnchorRemoved is called after an anchor is removed from the AR scene * The subscribing to an event part happens in Awake() */ public void AnchorRemoved(ARUserAnchor anchor) { Debug.Log("AnchorRemovedExample: " + anchor.identifier); }