Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by WJRRO · Aug 14, 2016 at 04:59 AM · removeoculus riftdetect

Detecting Oculus HMD is removed

While running and with an Oculus HDM attached does anyone know of a way to detect if the user/player has removed the headset? I'm trying to setup a script to trigger rendering on screen instructions to the desktop display and then reload the scene once a new player puts the headset on to restart the experience in a multi user scenario.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by WJRRO · Aug 24, 2016 at 05:17 AM

@delphinius81 Posting your answer from Oculus Dev forums:

"You can register delegates for the HMDMounted and HMDUnmounted events through OVRManager.

 OVRManager.HMDMounted += HandleHMDMounted;
 OVRManager.HMDUnmounted += HandleHMDUnmounted;
 
 void HandleHMDMounted() {
    // Do stuff
 }
 
 void HandleHMDUnmounted() {
    // Do stuff
 }
 



Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Barliesque · Apr 30, 2020 at 12:12 AM 0
Share

Before using that event to detect when the player puts the headset on, I suggest checking to see if they're already wearing the headset. If they are, that event won't be fired until they remove the headset and put it back on.

         if (OVRPlugin.userPresent)
         {
             Headset$$anonymous$$ounted();
         }
         else
         {
             OVR$$anonymous$$anager.H$$anonymous$$D$$anonymous$$ounted += Headset$$anonymous$$ounted;
         }
 
avatar image
1

Answer by Hyperactive · Feb 07, 2018 at 10:27 AM

Yesterday I was working on this issue and figured that HMD mount detection happens in OVRManager here:

 if (!_wasHmdPresent && isHmdPresent)
         {
             try
             {
                 if (HMDAcquired != null)
                     HMDAcquired();
                         //Put here code that you want to run when the HMD is mounted.
             }`

And then the same goes for removal of the HMD:

     if (_wasUserPresent && !isUserPresent)
         {
             try
             {
                 if (HMDUnmounted != null)
                     HMDUnmounted();
                         //Put here code that you want to run when the HMD is unmounted.
             }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by CorstiaanMediamonks · Apr 04, 2017 at 09:01 AM

Has anyone succeeded in getting this to actually work?

I've tried this but doesn't do anything. When the HMD is taken off, the screen goes black and Unity app suspends.. I haven't been able to run any code in response.

 OVRManager.HMDUnmounted += OnHDUnmounted;
 
 private void OnHDUnmounted()  {
     VRSettings.enabled = false;
     BackToMenu();     
 }



Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image WJRRO · Apr 04, 2017 at 02:06 PM 0
Share

To get content to continue rendering after you remove the headset you need to enable both run in background in the player settings and inside OVR$$anonymous$$anager set "runInBackground" bool to "true".

avatar image
0

Answer by Phildo · Dec 07, 2017 at 03:34 PM

This still does not work for me. See this question: https://answers.unity.com/questions/1439714/unity-oculus-ovr-not-responding-to-removeput-on-he.html

I see the comment saying "enable run in background in player settings and inside OVRManager" - I've done so in Player Settings (and in code), but OVRManager lacks a "runInBackground" property... (see docs here: https://developer3.oculus.com/doc/1.18-unity/class_o_v_r_manager.html )

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

73 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I remove Visual Studio from unity and continue to use MonoDevelop? 1 Answer

Skinning Editor Bones Disappear,Bones disappeared from Sprite Editor after Exiting Unity 4 Answers

Oculus Rift not working with Unity 5? 4 Answers

Help me doing teleportation with oculus touch 1 Answer

I can't access play mode with Oculus 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges