コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        // 1
        if (Controller.GetAxis() != Vector2.zero)
        {
            if (Controller.GetAxis().y > 0)
            {
                ViveCommands.moveForward();
            }
            if (Controller.GetAxis().y < 0)
            {
                //Down Move Robot Backwards
                ViveCommands.moveBack();
            }

            if (Controller.GetAxis().x > 0)
            {
                //Right Rotate Robot to the Right
                ViveCommands.turnRight();
            }

            if (Controller.GetAxis().x < 0)
            {
                //Left Rotate Robot to the Left
                ViveCommands.turnLeft();
            }

            //  Debug.Log(gameObject.name + Controller.GetAxis());
        }

        // 2
        if (Controller.GetHairTriggerDown())
        {
            Debug.Log(gameObject.name + " Trigger Press");
            //Lift Left Arm
        }

        // 3
        if (Controller.GetHairTriggerUp())
        {
            Debug.Log(gameObject.name + " Trigger Release");
            //Release Left Arm
        }



        // 4
        if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
        {
            Debug.Log(gameObject.name + " Grip Press");
            //Magnet ON
        }

        // 5
        if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
        {
            Debug.Log(gameObject.name + " Grip Release");
            //Magnet OFF
        }
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        // 1
        if (Controller.GetAxis() != Vector2.zero)
        {
            //NA
            //  Debug.Log(gameObject.name + Controller.GetAxis());
        }

        // 2
        if (Controller.GetHairTriggerDown())
        {
            ViveCommands.magnetArm();
        }

        // 3
        if (Controller.GetHairTriggerUp())
        {
            // Debug.Log(gameObject.name + " Trigger Release");
            //Release Right Arm
        }



        // 4
        if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
        {
            // Debug.Log(gameObject.name + " Grip Press");
            //Magnet ON
            ViveCommands.magnetOn();
        }

        // 5
        if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
        {
            //Debug.Log(gameObject.name + " Grip Release");

            //Magnet OFF
            ViveCommands.magnetOn();
        }
    }