Skip to main content
Participant
October 3, 2014

Listening for health & safety button keypress?

Okay, this may be a dumb question. Say I want to present a dialog that says "Face forward and press any key when you are comfortable" or some kind of similar recenter dialog.

If I write something like the following:

void Update() {
if (state == STATE_INIT) {
drawRecenterDialog();
state = STATE_RECENTER;
} else if (state == STATE_RECENTER && Input.anyKeyDown) {
// record user's default position and start the application
}
}


When the user presses a button to dismiss the health and safety warning, the second branch will also get triggered, incorrectly. I believe that the health and safety warning also goes away after some amount of time (even with no keypress). How should I code for this? Is there a variable or setting that detects the presence of the warning?

    3 replies

    Inspiring
    October 3, 2014
    What engine are you using?

    I believe in Unity you can check if the HSW is being shown, and then add your recenter code if it's not.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    October 3, 2014
    kburkeAuthor
    Participant
    October 3, 2014
    Aha, thanks for your help!!
    What works and what doesn't in VR interface design - Twenty Milliseconds