2
\$\begingroup\$

our game relies heavily on some Joints attached (not childs) to the tracked controllers. But those controllers get disabled when a user clicks on the system button which actually break our physics when user get back in game.

Is there a way to keep them active ? i checked they get Disabled in SteamVR_ControllerManager and could just risk commenting that block.

Or any event method called when the user opens the VR Dashboard ?

Thank you.

We are using Unity 5.6.0 and the latest SteamVR plugin.

\$\endgroup\$
  • \$\begingroup\$ Can you detect when they're disabled and just disable your springs at the same time? Then re-enable after that? \$\endgroup\$ – MichaelHouse Jul 26 '17 at 21:58
  • \$\begingroup\$ Yes, the onDisable event was fired. the used workaround was to child the joints to the SteamVR rig anchor, and separate them on OnEnable. \$\endgroup\$ – Omar Guendeli Jul 26 '17 at 22:02
  • \$\begingroup\$ Cool, can you post it as an answer? \$\endgroup\$ – MichaelHouse Jul 26 '17 at 22:03
1
\$\begingroup\$

I first tried commenting those two methods that appear in SteamVR_ControllerManager.cs line 130

// Reparents to a new object and deactivates that object (this allows
// us to call SetActive in OnDeviceConnected independently.
private void HideObject(Transform t, string name)
{
    if (t.gameObject.name.StartsWith(hiddenPrefix))
    {
        Debug.Log("Ignoring double-hide.");
        return;
    }
    var hidden = new GameObject(name).transform;
    hidden.parent = t.parent;
    t.parent = hidden;
    hidden.gameObject.SetActive(false);
}
private void ShowObject(Transform t, string name)
{
    var hidden = t.parent;
    if (hidden.gameObject.name != name)
        return;
    t.parent = hidden.parent;
    Destroy(hidden.gameObject);
}

Even if it didn't break anything in our Q&A and testings. we kept them as is but instead attached a script on our SteamVR Rig anchors that attach those Joints during the OnDisable() and detach them on OnEnable().

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.