Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by Patrice_VAC · Sep 15, 2020 at 01:46 PM · oculustrackingscriptingproblem

Reverse head tracker output around y axis

Hi, I am using Unity 5.3 and the oculus DK2 to prepare an experiment in psychology (so, as you can guess, I am not a developper). I would like to display a Unity scene flipped upside-down (not rotated) in the oculus. Following somes responses on Unity Answer, I attached the following code to the camera and it works well.

 public class Mirrorcam : MonoBehaviour {
     Camera MyCam; 
     void OnPreCull () {
         MyCam = GetComponent<Camera>();
         MyCam.projectionMatrix = MyCam.projectionMatrix * Matrix4x4.Scale(new Vector3(1,-1,1));
         MyCam.SetStereoProjectionMatrices(MyCam.projectionMatrix, MyCam.projectionMatrix); 
     }
     void OnPreRender () {
         GL.invertCulling = true;
     }
 }  

Now the scene is upside down but obviously we look on the left of the scene when turning the head on the right and vice versa. So I need to reverse the output of the oculus head tracker around the y axis. Again following some advices, I created an empty object as a parent for the camera and attached the following code to the object :

 public class MirrorTracking : MonoBehaviour {
    void Update () 
     {
     Quaternion angles = InputTracking.GetLocalRotation(VRNode.CenterEye);
     transform.rotation = Quaternion.Euler(-2*angles.eulerAngles.x,angles.eulerAngles.y,-2*angles.eulerAngles.z);
     }
 }

It works relatively well (it is a bit unstable) as long as head movements are not too large. But when looking too far up and down, the camera starts spinning around. As I plan to have my participants in a supine position, it won't work... From what I read on the unity forum, I guess its because I am treating the element of a quaternion as euler angles but I don't know the math to do better. Is there another way to reverse head tracking data on one axis? Thank you for your help.

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

0 Replies

· Add your reply
  • Sort: 

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

136 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 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

Oculus Rift S loses tracking after unmounted HMD sits still for a few seconds. Then reverts to default orientation. 0 Answers

Oculus Rift Track where the left palm goes 1 Answer

Disable Oculus tracking 1 Answer

Is there a way to disable OVRplayerController tracking for use with networking such as Photon? (Oculus Integration) 1 Answer

Get correct floor height for OculusQuest 1 Answer


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