Ejemplo n.º 1
0
 void FirstFrameUpdate(UnityARCamera cam)
 {
     sessionStarted = true;
     UnityARSessionNativeInterface.ARFrameUpdatedEvent -= FirstFrameUpdate;
 }
Ejemplo n.º 2
0
 public void ARFrameUpdated(UnityARCamera camera)
 {
     m_PointCloudData = camera.pointCloudData;
     frameUpdated     = true;
 }
Ejemplo n.º 3
0
 private void ARFrameUpdated(UnityARCamera camera)
 {
     pointCloudData = camera.pointCloudData;
     frameUpdated   = true;
 }
 private void ARFrameUpdated(UnityARCamera camera)
 {
     mFrameUpdated = true;
     mARCamera     = camera;
 }
Ejemplo n.º 5
0
 public void ARFrameUpdated(UnityARCamera camera)
 {
     m_PointCloudData = camera.pointCloud.Points;
 }
 void CheckWorldMapStatus(UnityARCamera cam)
 {
     text.text     = cam.worldMappingStatus.ToString();
     tracking.text = cam.trackingState.ToString() + " " + cam.trackingReason.ToString();
 }
Ejemplo n.º 7
0
 // invoked by TrackingChanged-event
 private void ARSessionTrackingChanged(UnityARCamera camera)
 {
     cameraTrackingState  = camera.trackingState;
     cameraTrackingReason = camera.trackingReason;
 }
Ejemplo n.º 8
0
 void FirstFrameUpdate(UnityARCamera cam)
 {
     sessionStarted = true;
     lastPos        = m_camera.transform.localPosition;
 }
Ejemplo n.º 9
0
 protected void ARFrameUpdated(UnityARCamera camera)
 {
     mFrameUpdated = true;
     mARCamera     = camera;
 }
Ejemplo n.º 10
0
 void UpdateLightEstimation(UnityARCamera camera)
 {
     LightEstimation = camera.lightData.arLightEstimate.ambientIntensity / 1000.0f;
 }
Ejemplo n.º 11
0
    public void ARFrameUpdated(UnityARCamera camera)
    {
        if (AddedAndReadyToScale)
        {
            return;
        }

        // cast a ray to see if you tapped on an existing items, if so make that the current item to move around
        if (Input.touchCount > 0 && touchedScreen && !mySelectorOpen && MovingFloatObject == null && !TappedCloudPoint)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, maxRayDistance))
            {
                if (hit.collider.name != "plane" && hit.collider.name != "Plane")
                {
                    Message.text         = "Tap to move, pinch to scale and tap Ok.";
                    AddedAndReadyToScale = true;
                    MovingFloatObject    = hit.transform.gameObject;
                    StartEditing();
                    return;
                }
            }
        }

        // did we just finish adding a object, if so listen for a new tap
        // this is to miss the tap on the okay button, I might be able to loose this
        if (TappedCloudPoint && !MovingFloatObject)
        {
            TappedCloudPoint = false;
            return;
        }

        // didn't tap on anything
        // the touch code to create and move that object
        if (Input.touchCount > 0 && touchedScreen && !mySelectorOpen && MovingFloatObject == null && !TappedCloudPoint)
        {
            var touch = Input.GetTouch(0);
            //var touchFinger2 = Input.GetTouch(1);

            var screenPosition = Camera.main.ScreenToViewportPoint(touch.position);
            point = new ARPoint
            {
                x = screenPosition.x,
                y = screenPosition.y
            };

            // prioritize reults types
            // ARHitTestResultType[] resultTypes = {
            //ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingGeometry,
            //ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingExtent,
            // if you want to use infinite planes use this:
            //ARHitTestResultType.ARHitTestResultTypeExistingPlane,
            //ARHitTestResultType.ARHitTestResultTypeEstimatedHorizontalPlane,
            //ARHitTestResultType.ARHitTestResultTypeEstimatedVerticalPlane,
            //ARHitTestResultType.ARHitTestResultTypeFeaturePoint
            //};

            //hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface ().HitTest(point, resultTypes);

            // first try to mount to a feature point
            hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, ARHitTestResultType.ARHitTestResultTypeFeaturePoint);

            // if no points use the plane that was found
            //if (hitResults.Count < 1)
            //{
            //hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point,ARHitTestResultType.ARHitTestResultTypeExistingPlane);
            //}

            //Debug.Log(hitResults.Count);

            if (hitResults.Count > 0)
            {
                TappedCloudPoint = true;
                ScreenBlocker.SetActive(false);

                foreach (var hitResult in hitResults)
                {
                    position = UnityARMatrixOps.GetPosition(hitResult.worldTransform);
                    break;
                }

                if (MovingFloatObject == null)
                {
                    // create the object, there isn't one
                    AddFloatObject(position);
                    Message.text         = "Created Object, pinch to scale... Tap Ok.";
                    AddedAndReadyToScale = true;

                    StartEditing();
                }

                ScreenBlocker.SetActive(false);
            }
        }

        Logger.text = updateMessage;
    }
Ejemplo n.º 12
0
 bool IsTracking(UnityARCamera arCam)
 {
     // todo: is limited ok for tracking?
     return(arCam.trackingState == ARTrackingState.ARTrackingStateNormal ||
            arCam.trackingState == ARTrackingState.ARTrackingStateLimited);
 }
Ejemplo n.º 13
0
 void TrackingChanged(UnityARCamera camera)
 {
     _arTrackingState       = camera.trackingState;
     _arTrackingStateReason = camera.trackingReason;
 }
Ejemplo n.º 14
0
 void TrackingChanged(UnityARCamera cam)
 {
     trackingStateText.text  = cam.trackingState.ToString();
     trackingReasonText.text = cam.trackingReason.ToString();
 }
Ejemplo n.º 15
0
 void FrameUpdate(UnityARCamera cam)
 {
     //can't get the light direction estimate to work for some reason, it freezes the app
     //keylight.transform.rotation = Quaternion.FromToRotation(Vector3.back, cam.lightData.arDirectonalLightEstimate.primaryLightDirection); // <- probably incorrect way to do it
     //keylight.transform.rotation = Quaternion.LookRotation(cam.lightData.arDirectonalLightEstimate.primaryLightDirection); // <- probably correct way to do it
 }
Ejemplo n.º 16
0
 void UpdateLightEstimations(UnityARCamera cam)
 {
     _intensity = cam.lightData.arLightEstimate.ambientIntensity;
     _colorTemp = cam.lightData.arLightEstimate.ambientColorTemperature;
 }