Example #1
0
    void Start()
    {
        ViveController vc = GetComponent <ViveController>();

        vc.OnSwipe += OnSwipe;
        isRotate    = false;
    }
Example #2
0
 public void DefaultDrop()
 {
     transform.parent = null;
     GetComponent <Rigidbody>().isKinematic = false;
     GetComponent <Rigidbody>().velocity    = simulator.velocity;
     parent = null;
 }
Example #3
0
 void OnEnable()
 {
     if (!rightGrab)
     {
         rightGrab = GameObject.Find("Controller (right)").GetComponent <ViveController>();
     }
     //if (!airsigManager)
     // {
     airsigManager = GameObject.Find("AirSigManager").GetComponent <AirSigManager>();
     // }
     airsigManager.SetMode(AirSigManager.Mode.DeveloperDefined);
     //airsigManager.SetDeveloperDefinedTarget(List<string> "Pickaxe");
     airsigManager.SetClassifier(
         "Pickaxe", "");
     airsigManager.SetTriggerStartKeys(
         AirSigManager.Controller.RIGHT_HAND,
         SteamVR_Controller.ButtonMask.Trigger,
         AirSigManager.PressOrTouch.PRESS);
     airsigManager.SetDeveloperDefinedTarget(
         new List <string> {
         "Pickaxe",
         "DOWN"
     }
         );
     developerGesture =
         new AirSigManager.OnDeveloperDefinedMatch(
             HandleOnDeveloperDefinedMatch);
     airsigManager.onDeveloperDefinedMatch +=
         developerGesture;
 }
Example #4
0
 // Use this for initialization
 void Start()
 {
     ray              = GetComponent <ControllerRay> ();
     controller       = GetComponent <ViveController> ();
     crosshair        = GameObject.FindGameObjectWithTag("Crosshair").GetComponent <Crosshair>();
     layerManager     = GameObject.FindObjectOfType <LayerManager> ();
     tempObjectHolder = GameObject.FindGameObjectWithTag("Temp");
 }
Example #5
0
 void Start()
 {
     simulator                  = new GameObject().AddComponent <Rigidbody>();
     simulator.name             = "simulator";
     simulator.transform.parent = transform.parent;
     //initialize ViveController
     controllerObj = GetComponent <ViveController>();
 }
 void Awake()
 {
     trackedObject = GetComponent <SteamVR_TrackedObject>();
     //controlMan = GameObject.Find("[CameraRig]").GetComponent<SteamVR_ControllerManager>();
     if (!rightGrab)
     {
         rightGrab = GameObject.Find("Controller (right)").GetComponent <ViveController>();
     }
 }
Example #7
0
    public virtual void released(ViveController controller)
    {
        //if (debug) { Debug.Log(gameObject.name + " has been released."); }
        gameObject.transform.parent = null;
        gameObject.GetComponent <Rigidbody>().isKinematic = false;
        gameObject.GetComponent <Rigidbody>().useGravity  = true;
        grabbedBy = null;

        gameObject.GetComponent <Rigidbody>().velocity = getReleaseVelocity();
    }
Example #8
0
 public void Drop()
 {
     drop.Invoke();
     if (drop.GetPersistentEventCount() == 0)
     {
         DefaultDrop();
     }
     if (parent != null)
     {
         parent.controller.TriggerHapticPulse(3999);
     }
     parent = null;
 }
Example #9
0
    public virtual void grabbed(ViveController controller)
    {
        //if(debug) { Debug.Log(gameObject.name + " has been grabbed."); }
        gameObject.transform.parent = controller.transform;
        gameObject.GetComponent <Rigidbody>().useGravity  = false;
        gameObject.GetComponent <Rigidbody>().isKinematic = true;

        //deal with passing from hand to hand
        if (grabbedBy != null && grabbedBy.gameObject != controller.gameObject && grabbedBy.GetComponent <ViveController>() != null)
        {
            grabbedBy.GetComponent <ViveController>().forgetGrabbed();
        }
        grabbedBy = controller.transform;
    }
Example #10
0
    private IEnumerator VibrateControllers(ViveController viveController, float durationInSeconds = 0.1f)
    {
        for (float seconds = 0; seconds < durationInSeconds; seconds += 0.01f)
        {
            if (leftController != null && viveController != ViveController.RIGHT)
            {
                leftController.TriggerHapticPulse();
            }

            if (rightController != null && viveController != ViveController.LEFT)
            {
                rightController.TriggerHapticPulse();
            }

            yield return(new WaitForSeconds(0.01f));
        }
    }
Example #11
0
    public static PilotActionMap CreatePilotActionMap(ViveController viveController)
    {
        InputMap <WingsuitAction, float> allAxisInput = new InputMap <WingsuitAction, float>();

        allAxisInput = allAxisInput.Update(WingsuitAction.Pitch, () => viveController.Pitch);
        allAxisInput = allAxisInput.Update(WingsuitAction.Roll, () => viveController.Roll);
        InputMap <WingsuitAction, float>       allMouseInput  = new InputMap <WingsuitAction, float>();
        InputMap <WingsuitAction, ButtonState> allButtonInput = new InputMap <WingsuitAction, ButtonState>();

        allAxisInput = allAxisInput.FillEmptyValues(PilotInput.PilotActionDetails.AxisActions,
                                                    () => 0.0f);
        allMouseInput = allMouseInput.FillEmptyValues(PilotInput.PilotActionDetails.AxisActions,
                                                      () => 0.0f);
        allButtonInput = allButtonInput.FillEmptyValues(PilotInput.PilotActionDetails.ButtonActions,
                                                        () => ButtonState.Released);

        return(new PilotActionMap(allButtonInput, allAxisInput, allMouseInput));
    }
Example #12
0
    //change orb type depending on which orbs can be used and showing the colors on the trackpad
    private void ChangeOrbType(OrbGun orbGun, ViveController viveController, Vector2 position)
    {
        Vector2 bottomToTop          = Vector2.up;
        Vector2 leftBottomToRightTop = new Vector2(2.0f, 2.0f);
        Vector2 rightBottomToLeftTop = new Vector2(-2.0f, 2.0f);

        bool left     = (-bottomToTop.x * position.y + bottomToTop.y * position.x) < 0;
        bool leftTop  = (-leftBottomToRightTop.x * position.y + leftBottomToRightTop.y * position.x) < 0;
        bool rightTop = (-rightBottomToLeftTop.x * position.y + rightBottomToLeftTop.y * position.x) > 0;

        int numberOfActiveOrbs = 0;

        for (OrbType orbType = OrbType.CommandOrb; orbType <= OrbType.TeleportOrb; ++orbType)
        {
            if (orbGun.IsOrbActive(orbType))
            {
                ++numberOfActiveOrbs;
            }
        }

        OrbType newOrb = OrbType.None;

        if (numberOfActiveOrbs == 2)
        {
            newOrb = GetOrbTypeForTwoActiveOrbs(left);
        }
        else if (numberOfActiveOrbs == 3)
        {
            newOrb = GetOrbTypeForFourActiveOrbs(left, leftTop, rightTop);
        }
        else if (numberOfActiveOrbs == 4)
        {
            newOrb = GetOrbTypeForFourActiveOrbs(leftTop, rightTop);
        }

        if (newOrb != OrbType.None)
        {
            if (orbGun.SetCurrentOrbTo(newOrb))
            {
                Vibration(viveController);
            }
        }
    }
Example #13
0
    // Use this for initialization
    void Start()
    {
        vrSystem = OpenVR.System;

        otherControllerScript = otherController.GetComponent <ViveController>();

        actionAreaManager = actionAreaObject.GetComponent <ActionAreaManager>();

        sliderMask    = 1 << LayerMask.NameToLayer("slider");
        nodesMask     = 1 << LayerMask.NameToLayer("nodes");
        moveScaleMask = 1 << LayerMask.NameToLayer("moveScale");
        playAreaMask  = 1 << LayerMask.NameToLayer("playArea");

        lineRend = projLineObj.GetComponent <LineRenderer>();

        linePts[0] = Vector3.zero;

        sqlConnClass     = sqlConnObject.GetComponent <TestSQLiteConn>();
        currSliderScript = timelineObject.GetComponent <TimelineScript>();

        accordianManager = accordianObj.GetComponent <AccordianManager>();
    }
    // Use this for initialization
    void Awake()
    {
        if (!lvlUpScreen)
        {
            lvlUpScreen = GameObject.Find("LevelUpScreen");
        }
        if (!vrInput)
        {
            vrInput = gameObject.GetComponent <VRUIinput>();
        }
        if (svrTrackedController)
        {
            svrTrackedController = gameObject.GetComponent <SteamVR_TrackedController>();
        }

        laserpointer     = gameObject.GetComponent <SteamVR_LaserPointer>();
        viveController   = gameObject.GetComponent <ViveController>();
        weaponControlVR  = gameObject.GetComponent <WeaponControlVR>();
        armswing         = GameObject.FindGameObjectWithTag("Player").GetComponent <ArmSwinger>();
        svrTrackedObject = gameObject.GetComponent <SteamVR_TrackedObject>();
        switchedtoGame   = true;
        popup            = GameObject.FindGameObjectWithTag("PopupDiag");
    }
Example #15
0
 public override void released(ViveController controller)
 {
     base.released(controller);
     StartCoroutine(explode());
 }
Example #16
0
 public void Vibration(ViveController viveController, float durationInSeconds = 0.1f)
 {
     StopCoroutine(VibrateControllers(viveController, durationInSeconds));
     StartCoroutine(VibrateControllers(viveController, durationInSeconds));
 }
Example #17
0
 void Start()
 {
     controller = GetComponent <ViveController>();
 }
Example #18
0
 public virtual void activate(ViveController controller)
 {
 }
Example #19
0
 void Start()
 {
     controller   = gameObject.transform.parent.GetComponent <ViveController> ();
     layerManager = GameObject.FindObjectOfType <LayerManager> ();
 }