Please Select Your Location
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Please Select Your Location
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

How do I switch heads with different tracking pose settings in the same scene?

If you created 2 or more heads with different tracking pose settings, the head will use the wrong pose data when they are switched without activating one head and deactivating the other heads.

Follow the steps below to avoid this problem.

There are two ways listed below on how to find the head in the same scene. These take advantage of the style of the tracking origin, TrackingUniverseSeated and TrackingUniverseStanding to switch two heads. Use the public flag HowToFindHead of ChooseDoF to select which find method you want to use.

public class ChooseDoF : MonoBehaviour {
        public ETrackingUniverseOrigin trackingSpace = ETrackingUniverseOrigin.TrackingUniverseSeated;
        public bool HowToFindHead = false;
        void OnEnable() {
                if (HowToFindHead)
                        method1();
                else
                        method2();
        }
        // For method 1, it makes use of the Transform function to find the head you would like to take.
        void method1() {
        #if UNITY_5_5_OR_NEWER
                // Global find
                GameObject body1 = transform.root.Find("‍Body1"‍).gameObject;
                GameObject body2 = transform.root.Find("‍Body2"‍).gameObject;
        #else
                // Children find
                GameObject body1 = transform.Find("‍Body1"‍).gameObject;
                GameObject body2 = transform.FindChild("‍Body2"‍).gameObject;
        #endif
                if (trackingSpace == ETrackingUniverseOrigin.TrackingUniverseSeated)
                        body1.SetActive(true);
                else
                        body2.SetActive(true);
        }
        // For method 2, it traverses the component list to find the head you would like to take.
        void method2() {
                // Children find
                var list = GetComponentsInChildren<WaveVR_Render>(true);

                foreach (WaveVR_Render render in list)
                {
                        var obj = render.transform.parent.gameObject;
                        if (trackingSpace == ETrackingUniverseOrigin.TrackingUniverseSeated)
                        {
                                if (obj.name == "‍Body1"‍)
                                {
                                        obj.SetActive(true);
                                        break;
                                }
                        }
                        else
                        {
                                if (obj.name == "‍Body2"‍)
                                {
                                        obj.SetActive(true);
                                        break;
                                }
                        }
                }
        }
}
  1. Before running, all heads are inactive.
  2. Under GameObject, do one of the following:
    • In Tracking Space, select Tracking Universe Seated to make the Body1 Head active.
    • In Tracking Space, select Tracking Universe Standing to make the Body2 Head active.
Submit
Thank you! Your feedback helps others to see the most helpful information.