Register() public method

Register to get Tango callbacks. The object should derive from one of ITangoDepth, ITangoEvent, ITangoPos, ITangoVideoOverlay, or ITangoExperimentalTangoVideoOverlay. You will get callback during Update until you unregister.
public Register ( object tangoObject ) : void
tangoObject object Object to get Tango callbacks from.
return void
コード例 #1
0
    // Use this for initialization
    void Start ()
    {
        // Initialize some variables
        m_tangoRotation = Quaternion.Euler(90,0,0);
        m_tangoPosition = Vector3.zero;
        m_startPosition = transform.position;
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        if(m_tangoApplication != null)
        {
            // Request Tango permissions
            m_tangoApplication.RegisterPermissionsCallback(PermissionsCallback);
            m_tangoApplication.RequestNecessaryPermissionsAndConnect();
            m_tangoApplication.Register(this);
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }

        m_uwTss = new Matrix4x4();
        m_uwTss.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (1, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_uwTss.SetColumn (2, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));
        
        m_dTuc = new Matrix4x4();
        m_dTuc.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_dTuc.SetColumn (1, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_dTuc.SetColumn (2, new Vector4 (0.0f, 0.0f, -1.0f, 0.0f));
        m_dTuc.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));


        Application.targetFrameRate = 60;

    }
コード例 #2
0
ファイル: TangoUx.cs プロジェクト: gitunit/project-tango-poc
 /// <summary>
 /// Start this instance.
 /// </summary>
 public void Start()
 {
     m_tangoApplication = GetComponent<TangoApplication>();
     m_tangoApplication.Register(this);
     AndroidHelper.InitTangoUx();
     SetHoldPosture(m_holdPosture);
 }
コード例 #3
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    private void Start()
    {
        Application.targetFrameRate = 60;

        m_tangoApplication = FindObjectOfType<TangoApplication>();

        if(m_tangoApplication != null)
        {
            if(AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent);
                m_tangoApplication.RequestNecessaryPermissionsAndConnect();
                m_tangoApplication.Register(this);
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it!
                StartCoroutine(_InformUserNoTangoCore());
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
    }
コード例 #4
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start() 
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoApplication.Register(this);

        m_uwTss.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (1, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_uwTss.SetColumn (2, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));

        m_cTuc.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (1, new Vector4 (0.0f, -1.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (2, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_cTuc.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));

        m_triangles = new int[VERT_COUNT];
        // Assign triangles, note: this is just for visualizing point in the mesh data.
        for (int i = 0; i < VERT_COUNT; i++)
        {
            m_triangles[i] = i;
        }

        m_mesh = GetComponent<MeshFilter>().mesh;
        m_mesh.Clear();
        m_mesh.triangles = m_triangles;
        m_mesh.RecalculateBounds();
        m_mesh.RecalculateNormals();
       
    }
コード例 #5
0
 /// <summary>
 /// Unity start override function.
 /// 
 /// We register this object as a listener to the pose callbacks.
 /// </summary>
 public void Start()
 {
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     
     if (m_tangoApplication != null)
     {
         m_tangoApplication.Register(this);
     }
 }
コード例 #6
0
    /// <summary>
    /// Set up cameras.
    /// </summary>
    private void Start()
    {
        Application.targetFrameRate = 60;
        EnableCamera();

        m_tangoApplication = FindObjectOfType<TangoApplication>();

        m_textures = m_tangoApplication.GetVideoOverlayTextureYUV();

        // Pass YUV textures to shader for process.
        m_screenMaterial.SetTexture("_YTex", m_textures.m_videoOverlayTextureY);
        m_screenMaterial.SetTexture("_UTex", m_textures.m_videoOverlayTextureCb);
        m_screenMaterial.SetTexture("_VTex", m_textures.m_videoOverlayTextureCr);

        m_tangoApplication.Register(this);
    }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     // Initialize some variables
     m_tangoRotation = Quaternion.identity;
     m_tangoPosition = Vector3.zero;
     m_startPosition = transform.position;
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     if (m_tangoApplication != null) {
         // Request Tango permissions
         m_tangoApplication.RegisterPermissionsCallback(PermissionsCallback);
         m_tangoApplication.RequestNecessaryPermissionsAndConnect();
         m_tangoApplication.Register(this);
     } else {
         Debug.Log("No Tango Manager found in scene.");
     }
 }
コード例 #8
0
    /// <summary>
    /// Initialize the AR Screen.
    /// </summary>
    private void Start()
    {
        // Constant matrix converting start of service frame to Unity world frame.
        m_uwTss = new Matrix4x4();
        m_uwTss.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (1, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_uwTss.SetColumn (2, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));
        
        // Constant matrix converting Unity world frame frame to device frame.
        m_cTuc.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (1, new Vector4 (0.0f, -1.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (2, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_cTuc.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));

        m_tangoApplication = FindObjectOfType<TangoApplication>();
        
        if(m_tangoApplication != null)
        {
            if(AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent);
                m_tangoApplication.RequestNecessaryPermissionsAndConnect();
                m_tangoApplication.Register(this);
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it.
                Debug.Log("Tango Core is outdated.");
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
        if(m_tangoApplication != null)
        {
            m_textures = m_tangoApplication.GetVideoOverlayTextureYUV();
            // Pass YUV textures to shader for process.
            m_screenMaterial.SetTexture("_YTex", m_textures.m_videoOverlayTextureY);
            m_screenMaterial.SetTexture("_UTex", m_textures.m_videoOverlayTextureCb);
            m_screenMaterial.SetTexture("_VTex", m_textures.m_videoOverlayTextureCr);
        }
        
        m_tangoApplication.Register(this);
    }
コード例 #9
0
    /// <summary>
    /// Initialize the AR Screen.
    /// </summary>
    public void Start()
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_arCameraPostProcess = gameObject.GetComponent<ARCameraPostProcess>();
        if (m_tangoApplication != null)
        {
            m_tangoApplication.Register(this);

            // Pass YUV textures to shader for process.
            m_textures = m_tangoApplication.GetVideoOverlayTextureYUV();
            m_screenMaterial.SetTexture("_YTex", m_textures.m_videoOverlayTextureY);
            m_screenMaterial.SetTexture("_UTex", m_textures.m_videoOverlayTextureCb);
            m_screenMaterial.SetTexture("_VTex", m_textures.m_videoOverlayTextureCr);
        }

        if (m_enableOcclusion) 
        {
            TangoPointCloud pointCloud = FindObjectOfType<TangoPointCloud>();
            if (pointCloud != null)
            {
                Renderer renderer = pointCloud.GetComponent<Renderer>();
                renderer.enabled = true;

                // Set the renderpass as background renderqueue's number minus one. YUV2RGB shader executes in 
                // Background queue which is 1000.
                // But since we want to write depth data to Z buffer before YUV2RGB shader executes so that YUV2RGB 
                // data ignores Ztest from the depth data we set renderqueue of PointCloud as 999.
                renderer.material.renderQueue = BACKGROUND_RENDER_QUEUE - 1;
                renderer.material.SetFloat("point_size", POINTCLOUD_SPLATTER_UPSAMPLE_SIZE);
                pointCloud.m_updatePointsMesh = true;
            }
            else
            {
                Debug.Log("Point Cloud data is not available, occlusion is not possible.");
            }
        }
    }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        // Prevent the screen from sleeping
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        // Initialize some variables
        m_tangoRotation = Quaternion.identity;
        m_tangoPosition = Vector3.zero;
        m_startPosition = transform.position;
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        if(m_tangoApplication != null)
        {
            // Request Tango permissions
            m_tangoApplication.RegisterPermissionsCallback(PermissionsCallback);
            m_tangoApplication.RequestNecessaryPermissionsAndConnect();
            m_tangoApplication.Register(this);
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }

        //sp = new SerialPort( "baka", 9600, Parity.None, 8, StopBits.One);

        //sp.Open();

        //sp.ReadTimeout = 50;
    }
コード例 #11
0
    /// <summary>
    /// Start is called on the frame when a script is enabled.
    /// </summary>
    public void Start()
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_characterController = GetComponent<CharacterController>();

        if (m_tangoApplication != null)
        {
            if (AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent);
                m_tangoApplication.RequestNecessaryPermissionsAndConnect();
                m_tangoApplication.Register(this);
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it!
                StartCoroutine(_InformUserNoTangoCore());
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }

        SetPose(transform.position, transform.rotation);
    }
コード例 #12
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start() 
    {
        m_isDirty = false;

        m_initCameraPosition = m_mainCamera.transform.position;

        m_coordinatePair.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE;
        m_coordinatePair.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE; // FIX should be depth sensor

        m_cubes = new GameObject[m_insertionCount];
        float size = 0.02f;
        for (int i = 0; i < m_insertionCount; i++)
        {
            m_cubes[i] = (GameObject)GameObject.CreatePrimitive(PrimitiveType.Cube);
            m_cubes[i].transform.localScale = new Vector3(size, size, size);
            m_cubes[i].transform.parent = transform;
        }

        syntheticRoom.SetActive(m_syntheticData);
        ClearLivePreviewCubes();

#if UNITY_ANDROID && !UNITY_EDITOR
        if (m_recordData)
        {
            PrepareRecording();
        }
#endif
        if (m_playbackData)
        {
            m_recordData = false;
            string filename = m_recordingID + ".dat";
            m_fileReader = new BinaryReader(File.Open(Application.persistentDataPath + "/" + filename, FileMode.Open));
            m_debugText = "Loading from: " + filename + " " + m_fileReader.ToString();
        }

        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoApplication.Register(this);

        if (m_testData)
        {
            GenerateTestData();
        }
    }
コード例 #13
0
 /// <summary>
 /// Unity Start function.
 /// 
 /// We find and assign pose controller and tango applicaiton, and register this class to callback events.
 /// </summary>
 public void Start()
 {
     m_poseController = FindObjectOfType<TangoARPoseController>();
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     
     if (m_tangoApplication != null)
     {
         m_tangoApplication.Register(this);
     }
 }
コード例 #14
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start()
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoApplication.Register(this);

        m_unityWorldTStartService.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(1, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(2, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

        // Assign triangles, note: this is just for visualizing point in the mesh data.
        m_points = new Vector3[MAX_POINT_COUNT];

        m_mesh = GetComponent<MeshFilter>().mesh;
        m_mesh.Clear();

        m_renderer = GetComponent<Renderer>();
        m_rand = new System.Random();
        if (m_enableOcclusion)
        {
            m_renderer.enabled = true;
            m_renderer.material.renderQueue = BACKGROUND_RENDER_QUEUE;
            m_renderer.material.SetFloat("point_size", POINTCLOUD_SPLATTER_UPSAMPLE_SIZE);
            m_updatePointsMesh = true;
        }
    }
コード例 #15
0
    /// <summary>
    /// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
    /// </summary>
    public void Start()
    {
        m_meshSavePath = Application.persistentDataPath + "/meshes";
        Directory.CreateDirectory(m_meshSavePath);

        m_arPoseController = FindObjectOfType<TangoARPoseController>();
        m_tangoDynamicMesh = FindObjectOfType<TangoDynamicMesh>();

        m_areaDescriptionLoaderPanel.SetActive(true);
        m_meshBuildPanel.SetActive(false);
        m_meshInteractionPanel.SetActive(false);
        m_relocalizeImage.gameObject.SetActive(false);

        // Initialize tango application.
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        if (m_tangoApplication != null)
        {
            m_tangoApplication.Register(this);
            if (AndroidHelper.IsTangoCorePresent())
            {
                m_tangoApplication.RequestPermissions();
            }
        }
    }
コード例 #16
0
    /// <summary>
    /// Unity Start() callback, we set up some initial values here.
    /// </summary>
    public void Start()
    {
        m_currentFPS = 0;
        m_framesSinceUpdate = 0;
        m_currentTime = 0.0f;
        m_fpsText = "FPS = Calculating";
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoPose = FindObjectOfType<TangoARPoseController>();
        m_arCameraPostProcess = FindObjectOfType<ARCameraPostProcess>();
        m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion();

        m_tangoApplication.Register(this);
    }
コード例 #17
0
    /// <summary>
    /// Unity Start function.
    /// 
    /// We find and assign pose controller and tango applicaiton, and register this class to callback events.
    /// </summary>
    public void Start()
    {
        // Constant matrix converting start of service frame to Unity world frame.
        m_uwTss = new Matrix4x4();
        m_uwTss.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn(1, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        m_uwTss.SetColumn(2, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

        // Constant matrix converting Unity world frame frame to device frame.
        m_dTuc = new Matrix4x4();
        m_dTuc.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_dTuc.SetColumn(1, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
        m_dTuc.SetColumn(2, new Vector4(0.0f, 0.0f, -1.0f, 0.0f));
        m_dTuc.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

        m_deltaPoseController = FindObjectOfType<TangoDeltaPoseController>();
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        
        if (m_tangoApplication != null)
        {
            m_tangoApplication.Register(this);
        }
    }
コード例 #18
0
    /// <summary>
    /// Start is called on the frame when a script is enabled.
    /// </summary>
    public void Start()
    {
        m_tangoARScreen = GetComponent<TangoARScreen>();

        m_tangoApplicaiton = FindObjectOfType<TangoApplication>();
        if (m_tangoApplicaiton != null)
        {
            m_tangoApplicaiton.Register(this);

            // If already connected to a service, then do initialization now.
            if (m_tangoApplicaiton.IsServiceConnected)
            {
                OnTangoServiceConnected();
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
    }
コード例 #19
0
ファイル: TangoUx.cs プロジェクト: techierajan/FirstLight
 /// <summary>
 /// Start this instance.
 /// </summary>
 public void Start()
 {
     m_tangoApplication = GetComponent<TangoApplication>();
     m_tangoApplication.RegisterPermissionsCallback(_OnTangoPermissionsEvent);
     m_tangoApplication.RegisterOnTangoConnect(_OnTangoServiceConnected);
     m_tangoApplication.RegisterOnTangoDisconnect(_OnTangoServiceDisconnected);
     m_tangoApplication.Register(this);
     AndroidHelper.InitTangoUx();
 }
コード例 #20
0
    /// <summary>
    /// Unity Start function.
    ///
    /// This function is responsible for initialization, including setting up m_fileSender and joining or creating a
    /// Photon room.
    /// </summary>
    public void Start()
    {
        m_cubeSize = m_cubePrefab[0].transform.lossyScale.x;

        m_progressPanel.SetActive(false);
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        if (m_tangoApplication == null)
        {
            _QuitGame();
        }

        m_tangoApplication.Register(this);
        m_tangoApplication.RequestPermissions();

        m_fileSender = GetComponent<RPCFileSender>();
        m_fileSender.OnPackageReceived += _OnAreaDescriptionTransferReceived;
        m_fileSender.OnPackageTransferFinished += _OnAreaDescriptionTransferFinished;
        m_fileSender.OnPackageTransferStarted += _OnAreaDescriptionTransferStarted;
        m_fileSender.OnPackageTransferError += _OnAreaDescriptionTransferError;

        if (!PhotonNetwork.insideLobby)
        {
            AndroidHelper.ShowAndroidToastMessage("Please wait to join the room until you are in lobby.");
            return;
        }
        
        if (Globals.m_curAreaDescription == null)
        {
            PhotonNetwork.JoinRandomRoom();
        }
        else
        {
            PhotonNetwork.CreateRoom("Random Room");
        }
    }
コード例 #21
0
    /// <summary>
    /// Unity Awake callback.
    /// </summary>
    public void Awake()
    {
        m_tangoApplication = GameObject.FindObjectOfType<TangoApplication>();
        if (m_tangoApplication != null)
        {
            m_tangoApplication.Register(this);
        }

        m_meshes = new Dictionary<Tango3DReconstruction.GridIndex, TangoSingleDynamicMesh>(100);
        m_gridIndexToUpdate = new List<Tango3DReconstruction.GridIndex>(100);
        m_gridUpdateBacklog = new HashSet<Tango3DReconstruction.GridIndex>();

        // Cache the renderer and collider on this object.
        m_meshRenderer = GetComponent<MeshRenderer>();
        if (m_meshRenderer != null)
        {
            m_meshRenderer.enabled = false;
        }

        m_meshCollider = GetComponent<MeshCollider>();
        if (m_meshCollider != null)
        {
            m_meshCollider.enabled = false;
        }

        if (m_enableSelectiveMeshing)
        {
            _InitGridIndexConfigs();
        }
    }
コード例 #22
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start()
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoApplication.Register(this);

        m_unityWorldTStartService.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(1, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(2, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

        // Assign triangles, note: this is just for visualizing point in the mesh data.
        m_points = new Vector3[MAX_POINT_COUNT];

        m_mesh = GetComponent<MeshFilter>().mesh;
        m_mesh.Clear();

        m_renderer = GetComponent<Renderer>();
        m_rand = new System.Random();
    }
コード例 #23
0
ファイル: TangoPointCloud.cs プロジェクト: tsi25/Zen
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start() 
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoApplication.Register(this);
        m_tangoDeltaPoseController = FindObjectOfType<TangoDeltaPoseController>();
        m_unityWorldTStartService.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(1, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(2, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

        // Constant matrix converting Unity world frame frame to device frame.
        m_colorCameraTUnityCamera.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_colorCameraTUnityCamera.SetColumn(1, new Vector4(0.0f, -1.0f, 0.0f, 0.0f));
        m_colorCameraTUnityCamera.SetColumn(2, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        m_colorCameraTUnityCamera.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
        
        // Assign triangles, note: this is just for visualizing point in the mesh data.
        m_points = new Vector3[MAX_POINT_COUNT];

        m_mesh = GetComponent<MeshFilter>().mesh;
        m_mesh.Clear();

        m_renderer = GetComponent<Renderer>();
        m_rand = new System.Random();
    }
コード例 #24
0
 /// <summary>
 /// Unity Start function.
 /// 
 /// This function is responsible for connecting callbacks, set up TangoApplication and initialize the data list.
 /// </summary>
 public void Start()
 {
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     
     if (m_tangoApplication != null)
     {
         m_tangoApplication.Register(this);
         if (AndroidHelper.IsTangoCorePresent())
         {
             m_tangoApplication.RequestPermissions();
         }
     }
     else
     {
         Debug.Log("No Tango Manager found in scene.");
     }
 }
コード例 #25
0
    /// @cond
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start() 
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoApplication.Register(this);
        m_tangoDeltaPoseController = FindObjectOfType<TangoDeltaPoseController>();
        m_unityWorldTStartService.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(1, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(2, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
        m_unityWorldTStartService.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

        // Constant matrix converting Unity world frame frame to device frame.
        m_colorCameraTUnityCamera.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        m_colorCameraTUnityCamera.SetColumn(1, new Vector4(0.0f, -1.0f, 0.0f, 0.0f));
        m_colorCameraTUnityCamera.SetColumn(2, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        m_colorCameraTUnityCamera.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
        
        // Assign triangles, note: this is just for visualizing point in the mesh data.
        m_points = new Vector3[MAX_POINT_COUNT];

        m_mesh = GetComponent<MeshFilter>().mesh;
        m_mesh.Clear();

        // Points used for finding floor plane.
        m_numPointsAtY = new Dictionary<float, int>();
        m_nonNoiseBuckets = new List<float>();

        m_renderer = GetComponent<Renderer>();
    }
コード例 #26
0
    /// <summary>
    /// Start is called on the frame when a script is enabled.
    /// </summary>
    public void Start()
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoARScreen = GetComponent<TangoARScreen>();

        if (m_tangoApplication != null)
        {
            if (AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.Register(this);
                m_tangoApplication.RequestPermissions();
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it!
                StartCoroutine(_InformUserNoTangoCore());
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
    }
コード例 #27
0
    /// <summary>
    /// Initialize the class.
    /// </summary>
    void Start()
    {
        // Prevent the tablet from falling asleep.
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        m_tangoRotation = Quaternion.identity;
        m_tangoPosition = Vector3.zero;
        m_tangoApplication = FindObjectOfType<TangoApplication>();

        if (m_tangoApplication != null)
        {
            m_tangoApplication.RegisterPermissionsCallback(PermissionsCallback);
            m_tangoApplication.RequestNecessaryPermissionsAndConnect();
            m_tangoApplication.Register(this);
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }

        // Get a handle to the rotation and movement toggle elements, and default
        // them to be unchecked.
        if (GameObject.Find("Rotation Toggle") != null)
        {
            m_toggleRotation = GameObject.Find("Rotation Toggle").GetComponent<Toggle>();
            m_toggleRotation.isOn = false;
        }
        if (GameObject.Find("Movement Toggle") != null)
        {
            m_toggleMovement = GameObject.Find("Movement Toggle").GetComponent<Toggle>();
            m_toggleMovement.isOn = false;
        }

        // Track the look rotation difference.
        m_lookRotationDiff = new Quaternion();
        m_lookRotationDiff.x = 0.0f;
        m_lookRotationDiff.y = 0.0f;
        m_lookRotationDiff.z = 0.0f;
        m_lookRotationDiff.w = 0.0f;
    }