Esempio n. 1
0
 private void OnAttachedToHand(Hand hand)
 {
     if (actionsetEnableOnGrab)
     {
         actionsetEnableOnGrab.ActivateSecondary();
     }
 }
Esempio n. 2
0
    public void Start()
    {
        hand            = GetComponent <Hand>();
        triggerDeadzone = 0.25f;
        lineRenderer    = GetComponent <LineRenderer>();

        // Activate platformer action set to use trackpad
        if (platformer != null)
        {
            platformer.ActivateSecondary();
        }
        trackpadAction = SteamVR_Input.__actions_platformer_in_Move;

        // Activate buggy action set to use trackpad
        if (buggy != null)
        {
            buggy.ActivateSecondary();
        }
        menuDownAction = SteamVR_Input.__actions_buggy_in_Reset;
    }
Esempio n. 3
0
        // Use this for initialization
        void Start()
        {
            actionSet.ActivateSecondary();
            poses    = GetComponent <KnucklePoses>();
            skeleton = GetComponent <SteamVR_Behaviour_Skeleton>();
            hand     = skeleton.inputSource;
            if (spiritGunPrefab != null)
            {
                GameObject spiritGun = Instantiate(spiritGunPrefab, skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.indexTip), skeleton.GetBoneRotation(SteamVR_Skeleton_JointIndexes.indexTip));
                spiritGunEffect = spiritGun.GetComponent <SpiritGunGlow>();
                spiritGunEffect.transform.parent = skeleton.GetBone(SteamVR_Skeleton_JointIndexes.indexTip);
            }
            if (shockPrefab != null)
            {
                shockObjects[0] = Instantiate(shockPrefab, skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.indexTip), skeleton.GetBoneRotation(SteamVR_Skeleton_JointIndexes.indexTip));
                shockObjects[0].transform.parent = skeleton.GetBone(SteamVR_Skeleton_JointIndexes.indexTip);
                shockObjects[0].SetActive(false);

                shockObjects[1] = Instantiate(shockPrefab, skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.middleTip), skeleton.GetBoneRotation(SteamVR_Skeleton_JointIndexes.middleTip));
                shockObjects[1].transform.parent = skeleton.GetBone(SteamVR_Skeleton_JointIndexes.middleTip);
                shockObjects[1].SetActive(false);

                shockObjects[2] = Instantiate(shockPrefab, skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.ringTip), skeleton.GetBoneRotation(SteamVR_Skeleton_JointIndexes.ringTip));
                shockObjects[2].transform.parent = skeleton.GetBone(SteamVR_Skeleton_JointIndexes.ringTip);
                shockObjects[2].SetActive(false);

                shockObjects[3] = Instantiate(shockPrefab, skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.pinkyTip), skeleton.GetBoneRotation(SteamVR_Skeleton_JointIndexes.pinkyTip));
                shockObjects[3].transform.parent = skeleton.GetBone(SteamVR_Skeleton_JointIndexes.pinkyTip);
                shockObjects[3].SetActive(false);

                shockObjects[4] = Instantiate(shockPrefab, skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.thumbTip), skeleton.GetBoneRotation(SteamVR_Skeleton_JointIndexes.thumbTip));
                shockObjects[4].transform.parent = skeleton.GetBone(SteamVR_Skeleton_JointIndexes.thumbTip);
                shockObjects[4].SetActive(false);

                if (hand == SteamVR_Input_Sources.LeftHand)
                {
                    foreach (GameObject shockObject in shockObjects)
                    {
                        shockObject.transform.localScale = new Vector3(1, 1, 1);
                    }
                }
            }
        }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     actionSet.ActivateSecondary();
 }