// invoked by AnchorUpdated-event private void PlaneAnchorUpdated(ARPlaneAnchor arPlaneAnchor) { string surfId = arPlaneAnchor.identifier; // update plane anchor if (planeAnchorDict.ContainsKey(surfId)) { ARPlaneAnchorGameObject arpag = planeAnchorDict[surfId]; arpag.planeAnchor = arPlaneAnchor; if (arpag.gameObject) { UnityARUtility.UpdatePlaneWithAnchorTransform(arpag.gameObject, arPlaneAnchor); } planeAnchorDict[surfId] = arpag; trackedPlanesTimestamp = GetLastFrameTimestamp(); } // update overlay surface MultiARInterop.MultiARData arData = arManager.GetARData(); if (arData.dictOverlaySurfaces.ContainsKey(surfId)) { UpdateOverlaySurface(arData.dictOverlaySurfaces[surfId], arPlaneAnchor); } }
public PlaneAnchor(ARPlaneAnchor anchor, GameObject planeObject) { this.anchor = anchor; this.planeObject = planeObject; _planeMeshRenderer = planeObject.GetComponentInChildren <MeshRenderer>(); UnityARUtility.UpdatePlaneWithAnchorTransform(planeObject, anchor); }
// Use this for initialization void Start() { #if !UNITY_EDITOR unityARAnchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(planePrefab); #endif }
protected override void Awake() { base.Awake(); Util.InstantiateTo(this.gameObject, remoteConnectionPrefab); unityARAnchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(TrackedPlanePrefab); }
// Use this for initialization void Start() { #if !UNITY_EDITOR unityARAnchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(planePrefab); // enter the setup phase when we start isSetupPhase = true; #endif }
void Start() { unityARAnchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(planePrefab); if (GameObject.FindObjectsOfType(this.GetType()).Length > 1) { Debug.LogWarning("There are several game objects with " + this.GetType() + " attached. Make sure there's only one."); } }
private void Start() { unityARAnchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(planeVisualizer); debugTextField = GameObject.Find("GameUI/DebugText").GetComponent <Text>(); Screen.sleepTimeout = SleepTimeout.NeverSleep; // multiplayer = MultiplayerContol.Instance; floorPlane.GetComponent <Renderer>().enabled = false; }
public void UpdateAnchor(ARPlaneAnchor arPlaneAnchor) { if (planeAnchorMap.ContainsKey(arPlaneAnchor.identifier)) { ARPlaneAnchorGameObject arpag = planeAnchorMap[arPlaneAnchor.identifier]; UnityARUtility.UpdatePlaneWithAnchorTransform(arpag.gameObject, arPlaneAnchor); arpag.planeAnchor = arPlaneAnchor; planeAnchorMap[arPlaneAnchor.identifier] = arpag; } }
public void Start() { uAM = new UnityARAnchorManager(); camera = Camera.main; UnityARUtility.InitializePlanePrefab(planePrefab); ray = Camera.main.ScreenPointToRay(Camera.main.transform.position); reservedPosition = new List <Vector3> (); // 原点はとらせない感じ reservedPosition.Add(Camera.main.transform.position); }
public void Update() { // if mouse button 0 was clicked if (Input.touchCount > 0 && isSetupPhase) { // figure out where we touched Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Ended) { Vector2 screenPoint = Camera.main.ScreenToViewportPoint(touch.position); ARPoint point = new ARPoint() { x = screenPoint.x, y = screenPoint.y }; // notify the WAREngine that a touch start event occured TriggerPointEvent("TouchStart", touch.position); // find all hitResults of type ExistingPlane List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest( point, ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingExtent ); // if we hit something if (hitResults.Count > 0) { Ray ray = Camera.main.ScreenPointToRay(touch.position); RaycastHit hit; if (Physics.Raycast(ray, out hit, 10.0f)) { // find the object we hit GameObject go = hit.collider.gameObject; // pack the values pertaining to a plane into a container and trigger InitBoard UIInput.InitBoard(new UIPlane { center = go.transform.position, extent = go.transform.localScale * 10, rotation = go.transform.rotation }); // and stop trying to place a table isSetupPhase = false; // we are done looking for anchors so we will not attach a collideable game obect to our anchors UnityARUtility.InitializePlanePrefab(new GameObject()); // clear the current set of planes and their anchor data unityARAnchorManager.Destroy(); } } } } }
private void Start() { // GvrTrackerインスタンス取得 vrTacker = MobileVRTracker.Instance; calibData = new CalibrationData(); // PointCloudパーティクル初期化 particleBase = Instantiate(pointCloudParticlePrefab); frameUpdated = false; UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; // Plane生成用Anchor anchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(planePrefab); }
private void Start() { #if UNITY_EDITOR // Disable AR in editor if (Camera.main != null) { Camera.main.clearFlags = CameraClearFlags.Color; UnityARVideo arVideo = Camera.main.GetComponent <UnityARVideo>(); if (arVideo != null) { arVideo.enabled = false; } Transform parent = Camera.main.transform.parent; if (parent != null) { UnityARCameraManager arCameraManager = parent.GetComponentInChildren <UnityARCameraManager>(); if (arCameraManager != null) { arCameraManager.enabled = false; } } } AR3DOFCameraManager ar3dof = GetComponent <AR3DOFCameraManager>(); if (ar3dof != null) { ar3dof.enabled = false; } #endif // Initialize the game object we'll use to // represent plane anchors if (planePrefab != null) { UnityARUtility.InitializePlanePrefab(planePrefab); } // Initialize the anchor manager mUnityARAnchorManager = new UnityARAnchorManager(); // Start the AR kit session ARKitWorldTackingSessionConfiguration sessionConfig = new ARKitWorldTackingSessionConfiguration( UnityARAlignment.UnityARAlignmentCamera, UnityARPlaneDetection.Horizontal ); sessionConfig.enableLightEstimation = true; UnityARSessionRunOption sessionRunOptions = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking; UnityARSessionNativeInterface.GetARSessionNativeInterface().Pause(); // Stops current run UnityARSessionNativeInterface.GetARSessionNativeInterface().RunWithConfigAndOptions(sessionConfig, sessionRunOptions); }
void Start() { unityARAnchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(planePrefab); }
public void UpdateAnchor(ARPlaneAnchor anchor) { this.anchor = anchor; UnityARUtility.UpdatePlaneWithAnchorTransform(planeObject, anchor); }
// Use this for initialization public void startPlaneGeneration() { unityARAnchorManager = new UnityARAnchorManager(); UnityARUtility.InitializePlanePrefab(planePrefab); }