Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Curtis's avatar
Curtis
Explorer
12 years ago

Using the razer hydras start button in Unity

So this question is probably more suited for sixenses forum, but it seems to be a ghost town over there so I hope I have a little more luck here ;)

So right now, when you press the start button on either controller it resets the hydras position to default/starting position. Which is great! But that means one of the buttons is basically going to waste, because they do the same thing.

I know how to get input from the start button, its the same as any other button and it works just fine. Except it resets the position. For the life of me, I can't find the code to disable this, or limit it to one controller.

Any help would be much appreciated!

2 Replies

  • Are you using the sixense hand controller script? If so, you will see base.Start() and base.UpdateObject(controller). Those call the ObjectControllerScript where you'll find the following code:
    if ( controller.GetButtonDown( SixenseButtons.START ) )
    {
    // enable position and orientation control
    m_enabled = !m_enabled;

    To activate both with one start button, you would have to change that to search out the other controller and enable it.
  • Ah, thanks for pointing me in the right direction!

    To be honest, I kinda just tried this on a whim and it worked. So maybe not the most elegant solution, but I changed line 27 of SixenseHandsController.cs

    from:

    if ( IsControllerActive( hand.m_controller ) && hand.m_controller.GetButtonDown( SixenseButtons.START ) )


    to:

    if ( IsControllerActive( hand.m_controller ) && SixenseInput.Controllers[0].GetButtonDown( SixenseButtons.START ) )



    So now only the left controller enables position and orientation, and leaves the right controllers start button open.