Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Official Disable HMD Roll in VR

Discussion in 'Particle System Previews' started by richardkettlewell, Mar 5, 2020.

  1. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,239
    We have an option in Unity since 2018.4 that disables camera roll, which prevents unwanted particle rotation when a user tilts their head in VR. It works for most use-cases, but there can be situations where it breaks (looking straight up/down).

    It's hard for us to fix this within Unity due to how our rendering code is organised, but it is possible to provide a more robust solution with a script, if you only have 1 camera to think about (which in VR is usually the case!)

    I'm sharing the scripts here for convenience - I'm providing one that works without Burst, which requires Unity 2018.4 (but can easily be modified to use a slower version of Set/GetParticles, which can work in any Unity verision) and a very fast optimized version that uses our Burst compiler, but requires Unity 2019.3 or newer.

    Almost all the credit for this goes to @bgolus, who wrote the original script and shared it here: https://forums.oculusvr.com/developer/discussion/5998/hmd-roll-and-particles
    I've simply converted it to run in a Burst C# job.
     

    Attached Files:

    RenderFX, KillMobil, jojue and 4 others like this.
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Thanks both of you for dev quality of life stuff :D
     
    richardkettlewell likes this.
  3. Mephesto_Khaan

    Mephesto_Khaan

    Joined:
    Jun 2, 2013
    Posts:
    47
    Just came from the future to say you need to convert the `_rotationDifference` to Radians.
     
    richardkettlewell likes this.
  4. cocapasteque

    cocapasteque

    Joined:
    Sep 30, 2016
    Posts:
    20
    I'm digging up this post to say that this still happens in 2020.1.17f1, even with the fix code you posted here :/
    It makes the particle system kinda useless for VR at this point :/

    I remember already getting this issue last year, and just found some not-pretty workarounds :/
     
  5. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,239
    Hi, we have no open reported bugs for this feature. You are welcome to report a bug and then we will be able to look at the issue.