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\$
3
  • \$\begingroup\$ Can you detect when they're disabled and just disable your springs at the same time? Then re-enable after that? \$\endgroup\$
    – House
    Jul 26, 2017 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\$ Jul 26, 2017 at 22:02
  • \$\begingroup\$ Cool, can you post it as an answer? \$\endgroup\$
    – House
    Jul 26, 2017 at 22:03

1 Answer 1

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\$

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .