Load() public method

public Load ( TextAsset text_asset ) : void
text_asset UnityEngine.TextAsset
return void
    /** Initalizes the hand and tool lists and recording, if enabled.*/
    void Start()
    {
        // Initialize hand lookup tables.
        hand_graphics_ = new Dictionary <int, HandModel>();
        hand_physics_  = new Dictionary <int, HandModel>();

        tools_ = new Dictionary <int, ToolModel>();

        smoothedFixedUpdateOffset_.delay = FIXED_UPDATE_OFFSET_SMOOTHING_DELAY;

        if (leap_controller_ == null)
        {
            Debug.LogWarning(
                "Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }

        LifecycleEventHandler handler = onStart;

        if (handler != null)
        {
            handler(this);
        }
    }
    void Start()
    {
        leap_controller_ = new Controller();

        Controller.PolicyFlag policy_flags = leap_controller_.PolicyFlags;
        if (isHeadMounted)
        {
            policy_flags |= Controller.PolicyFlag.POLICY_OPTIMIZE_HMD;
        }
        else
        {
            policy_flags &= ~Controller.PolicyFlag.POLICY_OPTIMIZE_HMD;
        }
        leap_controller_.SetPolicyFlags(policy_flags);

        hand_graphics_ = new Dictionary <int, HandModel>();
        hand_physics_  = new Dictionary <int, HandModel>();

        tools_ = new Dictionary <int, ToolModel>();

        if (leap_controller_ == null)
        {
            Debug.LogWarning(
                "Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }
    }
Example #3
0
    public void UpdateGesture()
    {
        //Aが押されたら、playからのrecordingデータを読み込む。
        //選択した文字の認識情報データをLeapMotionのFrameの再生と追跡をするメソッドLeapRecorderでローディング.frames_に格納される。
        player.Load(gesture.recording);


        //そのファイルのフレームの数を表示。
        Debug.Log("読み込んでいるdataのFrameCount:" + player.GetFramesCount());
        //そのファイルをFrame型にデシリアライズされたリスト型が入る。frames

        var newFrames = player.GetFrames();

        //読み込んだデータの

        //newFrames.RemoveRange(player.GetFramesCount() - 200, 199);
        //plyaerに保存されていたフレームは削除。

        player.Resets();
        //Recordingデータを再び、frames_に戻す。
        foreach (var f in newFrames)
        {
            player.AddFrame(f);
        }
    }
Example #4
0
    /** Initalizes the hand and tool lists and recording, if enabled.*/
    void Start()
    {
        var gesture_config = GetComponent <LeapGestureConfig>();

        if (gesture_config != null)
        {
            leap_controller_.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
            leap_controller_.Config.SetFloat("Gesture.Circle.MinArc", gesture_config.MinArc);
            leap_controller_.Config.SetFloat("Gesture.Circle.MinRadius", gesture_config.MinRadius);

            leap_controller_.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
            leap_controller_.Config.SetFloat("Gesture.Swipe.MinLength", gesture_config.MinLength);
            leap_controller_.Config.SetFloat("Gesture.Swipe.MinVelocity", gesture_config.MinVelocity);

            leap_controller_.Config.Save();
        }

        // Initialize hand lookup tables.
        hand_graphics_ = new Dictionary <int, HandModel>();
        hand_physics_  = new Dictionary <int, HandModel>();

        tools_ = new Dictionary <int, ToolModel>();

        if (leap_controller_ == null)
        {
            Debug.LogWarning(
                "Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }
    }
    /** Initalizes the hand and tool lists and recording, if enabled.*/
    void Start()
    {
        var parameter = FindObjectOfType <LeapMotionParameter>();

        gameObject.transform.localPosition = parameter.getPosition;
        handMovementScale = parameter.getMoveMent;
        // Initialize hand lookup tables.
        hand_graphics_ = new Dictionary <int, HandModel>();
        hand_physics_  = new Dictionary <int, HandModel>();

        tools_ = new Dictionary <int, ToolModel>();

        smoothedFixedUpdateOffset_.delay = FIXED_UPDATE_OFFSET_SMOOTHING_DELAY;

        if (leap_controller_ == null)
        {
            Debug.LogWarning(
                "Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }

        LifecycleEventHandler handler = onStart;

        if (handler != null)
        {
            handler(this);
        }
    }
Example #6
0
        void Update()
        {
            if (Input.GetKeyDown(keyToRecord))
            {
                Debug.Log("Record");
                recorder.state = RecorderState.Recording;
            }
            else if (Input.GetKeyDown(keyToSave))
            {
                Debug.Log("Save");

                recorder.state = RecorderState.Paused;
                Debug.Log(recorder.SaveToNewFile(recorderFilePath));
            }
            else if (Input.GetKeyDown(keyToReset))
            {
                recorder.Reset();
            }
            else if (Input.GetKeyDown(keyToPlay))
            {
                recorder.Play();
            }
            else if (Input.GetKeyDown(keyToPause))
            {
                recorder.state = RecorderState.Paused;
            }
            else if (Input.GetKeyDown(keyToLoad))
            {
                recorder.state = RecorderState.Stopped;
                recorder.Reset();
                recorder.Load(playerFilePath);
                recorder.Play();
            }
        }
Example #7
0
    // Use this for initialization
    void Start()
    {
        loader = new LeapRecorder();
        loader.Load(recorderFilePath);

        /*var original = ;
         * var clean = CleanFrames(original);
         * Debug.Log("Original: " + original.Count + " Cleaned: " + clean.Count);*/

        trainer.loadFromFrames(recorderFilePath, loader.GetFrames(), false);
    }
Example #8
0
    public void UpdateGesture()
    {
        player.Load(gesture.recording);

        Debug.Log(player.GetFramesCount());
        var newFrames = player.GetFrames();

        newFrames.RemoveRange(player.GetFramesCount() - 200, 199);
        player.Reset();
        foreach (var f in newFrames)
        {
            player.AddFrame(f);
        }
    }
Example #9
0
    /** Initalizes the hand and tool lists and recording, if enabled.*/
    void Start()
    {
        smoothedFixedUpdateOffset_.delay = FIXED_UPDATE_OFFSET_SMOOTHING_DELAY;

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }

        LifecycleEventHandler handler = onStart;

        if (handler != null)
        {
            handler(this);
        }
    }
Example #10
0
    /** Initalizes the hand and tool lists and recording, if enabled.*/
    void Start()
    {
        // Initialize hand lookup tables.
        hand_graphics_ = new Dictionary <int, HandModel>();
        hand_physics_  = new Dictionary <int, HandModel>();

        tools_ = new Dictionary <int, ToolModel>();

        if (leap_controller_ == null)
        {
            Debug.LogWarning(
                "Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }
    }
Example #11
0
    /** Initalizes the hand and tool lists and recording, if enabled.*/
    void Start()
    {
        //GetText ();
        StartCoroutine(GetText());
        //lineRenderer = gameObject.AddComponent<LineRenderer> ();

        //LINE RENDERER
        lineRenderer = gameObject.AddComponent <LineRenderer> ();
        linePoints   = new List <Vector3> ();
        //lineRenderer.positionCount = 1;
        lineRenderer.material   = new Material(Shader.Find("Particles/Additive"));
        lineRenderer.startWidth = 15;
        lineRenderer.endWidth   = 15;
        float    alpha    = 1.0f;
        Gradient gradient = new Gradient();

        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
            );
        lineRenderer.colorGradient = gradient;
        lineRenderer.loop          = false;

        //lineRenderer.SetPosition(0, new Vector3(5,5,100));


        // Initialize hand lookup tables.
        hand_graphics_ = new Dictionary <int, HandModel>();
        hand_physics_  = new Dictionary <int, HandModel>();

        tools_ = new Dictionary <int, ToolModel>();

        if (leap_controller_ == null)
        {
            Debug.LogWarning(
                "Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }
    }
Example #12
0
    /** Initalizes the hand and tool lists and recording, if enabled.*/
    void Start()
    {
        smoothedFixedUpdateOffset_.delay = FIXED_UPDATE_OFFSET_SMOOTHING_DELAY;

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }

        LifecycleEventHandler handler = onStart;

        if (handler != null)
        {
            handler(this);
        }

        /*** yuan yao ***/
        //Enable gestures: key_tap and swipe
        leap_controller_.EnableGesture(Gesture.GestureType.TYPE_KEY_TAP);
        leap_controller_.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
        leap_controller_.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);

        //Config
        leap_controller_.Config.SetFloat("Gesture.KeyTap.MinDownVelocity", 20.0f);
        leap_controller_.Config.SetFloat("Gesture.KeyTap.HistorySeconds", .2f);
        leap_controller_.Config.SetFloat("Gesture.KeyTap.MinDistance", 0.2f);

        leap_controller_.Config.SetFloat("Gesture.Swipe.MinLength", 200.0f);
        leap_controller_.Config.SetFloat("Gesture.Swipe.MinVelocity", 750f);

        leap_controller_.Config.SetFloat("Gesture.Circle.MinRadius", 20.0f);
        leap_controller_.Config.SetFloat("Gesture.Circle.MinArc", 2.0f);

        leap_controller_.Config.Save();

        ui_layer = LayerMask.GetMask("UI");

        handController = GameObject.Find("HandController");

        left_palm_position_array  = new Vector[5];
        right_palm_position_array = new Vector[5];
    }
    void Start()
    {
        this.transform.position += offset;
        leap_controller_         = new Controller();
        hand_graphics_           = new Dictionary <int, HandModel>();
        hand_physics_            = new Dictionary <int, HandModel>();

        tools_ = new Dictionary <int, ToolModel>();

        if (leap_controller_ == null)
        {
            Debug.LogWarning(
                "Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        if (enableRecordPlayback && recordingAsset != null)
        {
            recorder_.Load(recordingAsset);
        }
    }