/// <summary>
 /// Updates the rotation and position of the Character
 /// </summary>
 public void Update()
 {
     if (rtClient == null)
     {
         rtClient = RTClient.GetInstance();
     }
     if (!rtClient.GetStreamingStatus())
     {
         return;
     }
     markerData = rtClient.Markers;
     if ((markerData == null || markerData.Count == 0))
     {
         Debug.LogError("The stream does not contain any markers");
         return;
     }
     if (skeletonBuilder != null)
     {
         skeleton = skeletonBuilder.SolveSkeleton(markerData);
     }
     else
     {
         ResetSkeleton();
     }
     SetAll();
     if (!headCam.UseHeadCamera && headCamera)
     {
         DestroyCamera();
     }
 }
Esempio n. 2
0
    void Update()
    {
        // Check if the system is currently streaming
        if (rtClient.GetStreamingStatus())
        {
            // Get the data of the tracked object based on the name supplied
            SixDOFBody trackedObj = rtClient.GetBody(objectName);

            // If this object has a position value, that means it's tracked!
            if (!float.IsNaN(trackedObj.Position.sqrMagnitude))
            {
                // Apply the position and rotation to the object
                transform.position = trackedObj.Position;
                transform.rotation = trackedObj.Rotation;
            }
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (updateTimer > 0)
        {
            updateTimer -= Time.deltaTime;
        }

        if (rtClient.GetStreamingStatus())
        {
            SixDOFBody trackedObj = rtClient.GetBody(objectName);

            if (!float.IsNaN(trackedObj.Position.sqrMagnitude))
            {
                transform.position = trackedObj.Position;
                transform.rotation = trackedObj.Rotation;
            }
        }
    }