Example #1
0
    // gets data of current frame
    public ButtonInstance createInstance(IAppInfo appInfo, float timeStamp, GameObject tracker)
    {
        time     = timeStamp;
        instance = appInfo;
        //brushtype = null;
        //colorcon = GameObject.Find("App").GetComponent<TiltBrush.BrushColorController>();
        //color = colorcon.CurrentColor;
        // script = check script that is running
        //if (TiltBrush.BrushController.m_Instance != null)
        //{
        //    brushtype = TiltBrush.BrushController.m_Instance.ActiveBrush;
        //}
        //Debug.Log(brushtype);
        //toolobj = GameObject.Find("SketchSurface").GetComponent<TiltBrush.SketchSurfacePanel>();
        //tool = toolobj.ActiveToolType;
        //Debug.Log(tool);
        //brushcolor = TiltBrush.ColorController.trackColor;
        //Debug.Log(brushcolor);
        additionalInfo = instance.GetSerializedAdditionalInfo();
        color          = instance.GetColor();
        Transform lc   = instance.GetLeftController();
        Transform rc   = instance.GetRightController();
        Transform root = instance.GetSceneRootTransform();

        (leftControllerPos, leftControllerRot)   = getRelativePosRot(lc, root, tracker);
        (rightControllerPos, rightControllerRot) = getRelativePosRot(rc, root, tracker);
        //leftControllerPos = instance.GetLeftController().position;
        //rightControllerPos = instance.GetRightController().position;
        //leftControllerRot = instance.GetLeftController().rotation;
        //rightControllerRot = instance.GetRightController().rotation;
        ButtonStatus r = instance.GetRightTriggerStatus();
        ButtonStatus l = instance.GetLeftTriggerStatus();

        rightTriggerDown = (r == ButtonStatus.Down || r == ButtonStatus.Held);
        leftTriggerDown  = (l == ButtonStatus.Down || l == ButtonStatus.Held);
        //Debug.Log("Default: " + leftControllerPos + " | " + leftControllerRot);
        return(this);
    }