예제 #1
0
 void PopulateVideoFormatButtons()
 {
     foreach (UnityARVideoFormat vf in UnityARVideoFormat.SupportedVideoFormats())
     {
         GameObject        go  = Instantiate <GameObject> (videoFormatButtonPrefab, formatsParent);
         VideoFormatButton vfb = go.GetComponent <VideoFormatButton> ();
         if (vfb != null)
         {
             vfb.Populate(vf);
         }
     }
 }
예제 #2
0
    public void ExampletButtonPressed(UnityARVideoFormat videoFormat)
    {
        UnityARSessionNativeInterface session = UnityARSessionNativeInterface.GetARSessionNativeInterface();

        var config = new ARKitFaceTrackingConfiguration();

        if (config.IsSupported)
        {
            config.alignment             = UnityARAlignment.UnityARAlignmentGravity;
            config.enableLightEstimation = true;
            config.videoFormat           = videoFormat.videoFormatPtr;
            Application.targetFrameRate  = videoFormat.framesPerSecond;

            UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking;
            session.RunWithConfigAndOptions(config, runOption);
        }
    }
예제 #3
0
    public void ExampletButtonPressed(UnityARVideoFormat videoFormat)
    {
        //Restart session with new video format in config

        UnityARSessionNativeInterface session = UnityARSessionNativeInterface.GetARSessionNativeInterface();

        ARKitWorldTrackingSessionConfiguration config = new ARKitWorldTrackingSessionConfiguration();

        if (config.IsSupported)
        {
            config.planeDetection        = UnityARPlaneDetection.HorizontalAndVertical;
            config.alignment             = UnityARAlignment.UnityARAlignmentGravity;
            config.getPointCloudData     = true;
            config.enableLightEstimation = true;
            config.enableAutoFocus       = true;
            config.videoFormat           = videoFormat.videoFormatPtr;
            Application.targetFrameRate  = videoFormat.framesPerSecond;

            UnityARSessionRunOption runOption = UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors | UnityARSessionRunOption.ARSessionRunOptionResetTracking;
            session.RunWithConfigAndOptions(config, runOption);
        }
    }
예제 #4
0
 public void Populate(UnityARVideoFormat videoFormat)
 {
     arVideoFormat = videoFormat;
     videoFormatDescription.text = "VideoFormat Resolution: " + videoFormat.imageResolutionWidth + "x" + videoFormat.imageResolutionHeight + " FPS: " + videoFormat.framesPerSecond;
 }