Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard Detecting and Auto Pause #114

Open
wants to merge 12 commits into
base: Godot-3.x
Choose a base branch
from

Conversation

Nidonocu
Copy link

@Nidonocu Nidonocu commented Mar 14, 2021

When a player invokes the SteamVR Dashboard (normally by pressing the System Button on a controller), they expect their game or VR application to pause any gameplay until they have finished performing whatever actions they needed (changing settings, checking another application using the desktop view, etc.) and closed the dashboard.

This patch adds an OpenVRFocus Node that can be added to a scene that does the following:

  • Provide dashboard_opened and dashboard_closed signals
  • Provide an Use Auto Pause property. When enabled, automatically set the SceneTree to paused when the Dashboard is opened.

Using the signals, the game could manually trigger its pause menu, perform an auto-save in case the player uses the dashboard to quit the game, or importantly, hide the player avatar while the dashboard is open to prevent visual depth confusion caused by the Dashboard overlay rendering visually further away but on top of the player's frozen avatar body.
If the Auto Pause function is enabled, the Node will set the SceneTree to paused when the dashboard is opened. It will not however automatically unpause as commonly players want manually unpause once they have closed the dashboard and reviewed themselves the state of the game. Games will need to provide their own un-pause function.

This patch uses a new node rather than amending the OpenVRController, because the Dashboard can be triggered by user actions other than the System button on their controllers, such as the System button on the HMD or an action in the desktop GUI for SteamVR.

Demo

The demo has been modified to show hiding the player avatar when the dashboard is open, a manual pause on and off function has been added (Attached to /actions/godot/in/button_ax on the left hand), and the auto-pause when the dashboard opens is enabled. The cups, boxes and player hands have been set to stop when pause is enabled.

@BastiaanOlij
Copy link
Member

Cool, this normally should be going through the notification system in Godot but I'm not sure if we can trigger that from the plugin. I know @m4gr3d implemented it for Quest but there we have a few more options because of the way Android is structured.

Couple of things:

  • I would add this into OpenVRConfig instead of adding a new node.
  • check your settings, you've changed all GDScript files to be space indented causing really large commits. The standard we're sticking to here is tab indentation. (I really need to update clang-format for this)
  • make sure you squash your commits so there is just a single commit with all the changes

Thanks!! :)

@Nidonocu
Copy link
Author

Cool, this normally should be going through the notification system in Godot but I'm not sure if we can trigger that from the plugin. I know @m4gr3d implemented it for Quest but there we have a few more options because of the way Android is structured.

Couple of things:

  • I would add this into OpenVRConfig instead of adding a new node.
  • check your settings, you've changed all GDScript files to be space indented causing really large commits. The standard we're sticking to here is tab indentation. (I really need to update clang-format for this)
  • make sure you squash your commits so there is just a single commit with all the changes

Thanks!! :)

Regarding combining this in to OpenVRConfig, as that's currently only based on the reference type, it doesn't have a get_tree() method for the auto-pause functionality or even an automatically called _process() method so a consumer for this would need to write their own.

I could strip back all that functionality and just implement it on the API consumer-side in the demo if you think that's a better idea for keeping the interface 'cleaner'.

@BastiaanOlij BastiaanOlij added this to the 1.1.1 milestone Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants