Beispiel #1
0
    public static BGMotionManager GetInstance()
    {
        if (instance == null)
        {
            print("getting lock");
            lock (_lock) {
                if (instance == null)
                {
                    container = new GameObject("BGMotionManager");
                    instance  = container.AddComponent(typeof(BGMotionManager)) as BGMotionManager;

                    instance.bodyTrackerKeyboard = new BGBodyTrackerKeyboard(instance);

                    monoTrackerContainer = new GameObject("monoTrackerContainer");
                    print("made mono tracker");
                    instance.bodyTrackerMono = monoTrackerContainer.AddComponent(typeof(BGBodyTrackerMono)) as BGBodyTrackerMono;
                    ((instance.bodyTrackerMono) as BGBodyTrackerMono).SetOwner(instance);

                    nativeTrackerContainer     = new GameObject("nativeTrackerContainer");
                    instance.bodyTrackerNative = nativeTrackerContainer.AddComponent(typeof(BGBodyTrackerNative)) as BGBodyTrackerNative;
                    ((instance.bodyTrackerNative) as BGBodyTrackerNative).SetOwner(instance);

                    feedbackTexture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
                    DontDestroyOnLoad(container);
                    DontDestroyOnLoad(nativeTrackerContainer);
                    DontDestroyOnLoad(monoTrackerContainer);
                }
            }
        }
        return(instance);
    }
Beispiel #2
0
    public static BGMotionManager GetInstance()
    {
        if (instance == null) {
            print("getting lock");
            lock (_lock) {
                if (instance == null) {
                    container = new GameObject ("BGMotionManager");
                    instance = container.AddComponent (typeof(BGMotionManager)) as BGMotionManager;

                    instance.bodyTrackerKeyboard = new BGBodyTrackerKeyboard (instance);

                    monoTrackerContainer = new GameObject("monoTrackerContainer");
                    print("made mono tracker");
                    instance.bodyTrackerMono = monoTrackerContainer.AddComponent(typeof(BGBodyTrackerMono)) as BGBodyTrackerMono;
                    ((instance.bodyTrackerMono) as BGBodyTrackerMono).SetOwner(instance);

                    nativeTrackerContainer = new GameObject("nativeTrackerContainer");
                    instance.bodyTrackerNative = nativeTrackerContainer.AddComponent(typeof(BGBodyTrackerNative)) as BGBodyTrackerNative;
                    ((instance.bodyTrackerNative) as BGBodyTrackerNative).SetOwner(instance);

                    feedbackTexture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
                    DontDestroyOnLoad (container);
                }
            }
        }
        return instance;
    }
Beispiel #3
0
    void Start()
    {
        SetEnabledState(player2, false);
        BGMotionManager.GetInstance().SetPlayerCount(1);
        BGMotionManager.GetInstance().SetEditorWebcamMode();

        player1.GetComponent <CursorMovement>().SetCameraTransform(transform);
        player2.GetComponent <CursorMovement>().SetCameraTransform(transform);
    }
Beispiel #4
0
    void Start()
    {
        myTransform = gameObject.transform;

        m_Texture            = BGMotionManager.GetInstance().GetFeedbackTexture();
        m_Texture.filterMode = FilterMode.Point;
        renderer.sharedMaterial.mainTexture = m_Texture;

        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
        }
        else
        {
            myTransform.localScale = new Vector3(-myTransform.localScale.x, myTransform.localScale.y, myTransform.localScale.z);
        }
    }
Beispiel #5
0
    public void SetEnabledState(GameObject target, bool enabledState)
    {
        CursorMovement cm = target.GetComponent <CursorMovement>() as CursorMovement;

        if (enabledState)
        {
            BGMotionManager.GetInstance().AddBodyReadingListener(cm);
        }
        else
        {
            BGMotionManager.GetInstance().RemoveBodyReadingListener(cm);
        }

        //Sets visibility for an object and all its children
        target.SetActiveRecursively(enabledState);
        Renderer[] renderers = target.GetComponentsInChildren <Renderer>();
        foreach (Renderer r in renderers)
        {
            r.enabled = enabledState;
        }
    }
Beispiel #6
0
    void LateUpdate()
    {
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            //try to get video feed until we finally have it
            if (!isRendering && BGMotionManager.GetInstance().GetCurrentTracker().IsTracking())
            {
                StartOpenGLBodyFeedbackRendering(m_Texture.GetNativeTextureID());
                Debug.Log("Native texture ID: " + m_Texture.GetNativeTextureID().ToString());
                isRendering = true;
            }
                        #if UNITY_ANDROID
            if (Application.platform == RuntimePlatform.Android)
            {
                renderFeedbackToTexture();
            }
                        #endif
            renderer.material.mainTextureScale = new Vector2(1, 1);
        }
        else
        {
            //renderer.material.mainTexture = m_Texture;
            renderer.sharedMaterial.mainTextureScale = new Vector2(0.625f, 0.46875f);
        }

        if (Screen.orientation == ScreenOrientation.LandscapeRight)
        {
            targetLocalRotation = (Application.platform == RuntimePlatform.Android)?androidLandscapeRightRotation:landscapeRightRotation;             //
        }
        else
        {
            targetLocalRotation = (Application.platform == RuntimePlatform.Android)?androidLandscapeLeftRotation:landscapeLeftRotation;             //
        }

        myTransform.localEulerAngles = targetLocalRotation;
    }
 public BGBodyTrackerKeyboard(BGMotionManager mm)
 {
     owner = mm;
 }
Beispiel #8
0
 public void SetOwner(BGMotionManager mm)
 {
     owner = mm;
 }
Beispiel #9
0
 void Start()
 {
     BGMotionManager.GetInstance().AddBodyReadingListener(this);
     startPosition = transform.position;
     startScale    = transform.localScale;
 }
Beispiel #10
0
	public void SetOwner(BGMotionManager mm)
	{
		owner = mm;
	}
Beispiel #11
0
 public BGBodyTrackerKeyboard(BGMotionManager mm)
 {
     owner = mm;
 }