Exemplo n.º 1
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>();

        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);
        }
    }
Exemplo n.º 2
0
    /** 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);
        }
    }
Exemplo n.º 3
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);
        }
    }
Exemplo n.º 4
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];
    }