Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Start vibration on collision SteamVR

Discussion in 'Scripting' started by InMindStudios, Jan 26, 2021.

  1. InMindStudios

    InMindStudios

    Joined:
    Dec 5, 2020
    Posts:
    9
    Hey guys;
    The web is filled with outdated and no longer working guides and it makes me loose hours every day in wasted time an I cant find ANY guide for this that makes sense.

    I am building a Sword VR game in Unity and SteamVR. I have been trying for two days to get haptic feedback when my sword destroys an enemy.

    I aim to put the trigger for the haptic on my enemy script:


    Code (CSharp):
    1.  GameObject[] newGOs = new GameObject[2];
    2.             if (OptionalTargetObject == null)
    3.             {
    4.                 newGOs[0] = Instantiate(gameObject) as GameObject;
    5.                 newGOs[0].name = gameObject.name;
    6.                 newGOs[1] = gameObject;
    7.                 NextTarget.SetActive(true);
    8. //This is where I want the haptic command to go to give the controller a buzz.
    9.             }

    Thank you in advance! :)
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,750
    You might have more luck with this sort of API-specific question over in the VR/AR/XR board on this forum.
     
    InMindStudios likes this.
  3. InMindStudios

    InMindStudios

    Joined:
    Dec 5, 2020
    Posts:
    9
    Thank you. All new on this forum <3
     
    Kurt-Dekker likes this.