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 /
avatar image
0
Question by AR_Rizvi · Jan 07, 2017 at 09:45 AM · unity 5guivrcontroller

Open GUI on Certain HTC VIVe Controller Angle/Turn

Hi guys,

I am Trying to make a Rec Room(htc vive game) Esque GUI but having trouble in opening the GUI on certain controller angle i have done some work and achieved a bit sketchy one which is opening at certain angle but other then that its opening when the Controller is straight in front of camera on 90 degree as i wanted it to open only when controller is at certain angle (as a guy looking at his watch)

Here is some code i have managed

    void RayCastFromHead() // is just a  name for Method i am raycasting from a dummy which contains left Grip button
     {
         if (Physics.Raycast(dummy.position, dummy.up, out hitInfo, 30))
         {
              transform.rotation.ToAngleAxis(out tempAngle, out tempAxis);
 
             if (hitInfo.collider.name.Contains("Camera (eye)"))
             {
                 if (dummy.gameObject.GetComponent<MeshRenderer>().enabled)
                 {
                         if ((transform.localEulerAngles.z > 270.0f && transform.localEulerAngles.z < 315.0f)&&
                             (transform.position.y > 0.9f && transform.position.y < 2f))
                             
                         {
                             staticRotaion = transform.localRotation;
                             canvasOnHead.GetComponent<TweenScale>().PlayForward();
                          
                         }
                 }
             }
         }
     
     }

Here are some visual examples Normal GUI Closed Certain Angle/Turn (as a guy looking at his watch)

I do not know that it is a right method to do this kind of task Kindly look into this matter Any help would be appreciable

Regards AR

recroom-1-am.jpg (133.1 kB)
rec-room-2-am.jpg (161.2 kB)
Comment
Add comment · Show 3
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 AR_Rizvi · Jan 18, 2017 at 10:48 AM 0
Share

Seriously no one knows this ???

avatar image doublemax AR_Rizvi · Jan 18, 2017 at 11:46 AM 0
Share

What i would try:

  • add an empty gameobject to the hand so that its forward vector points directly at you when the hand is in the desired position

  • calculate the vector between the forward vector of that object and the forward vector of the camera/eye. If it's near 180 it's pointing at you.

Additionally, if you want to ensure that the hand is near the center of the display, you could add a sphere collider to the new object, make it about the size of a basket ball and use a raycast with with the forward vector of th e camera and check if it hits the sphere.

avatar image AR_Rizvi doublemax · Jan 21, 2017 at 07:25 AM 0
Share

at Last someOne thanks... I have tried the Pretty much same logic u just described and its working but i am unable to detect the certain angle of the hand let say 180 deg this is where i cant work my way out i tried solutions but cant manage to detect the exact 180 rotation of hand (Camera and hands both are Child's of a main parent )

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

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

[HTC Vive] Mix Reality using Steam VR without the third controller 0 Answers

bluetooth controller not working properly 0 Answers

Preparing the build for HTC Vive 1 Answer

Ovr controller weird rotation 2 Answers

Drawing UI text on GUI.DrawTexture , How to do it ? 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