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
0
Question by novavr · Sep 20, 2017 at 10:16 PM · scripting problemvr

Getting Oculus Touch Controllers Triggers to Set a GameObject Active

So in my code below when the user loads into the program they have a canvas GameObject attached to their right hand as a child. It is set inactive in start but it is assigned as a public variable in the editor where it is active when not in play mode. When the user presses the right index trigger for the first time the canvas should be set to active, then there are some things they can interact with that require the canvas to be there, then if they hold the right index trigger for three seconds it should disappear. Right now It doesn't work so when the user squeezes the right index trigger nothing happens. I feel like I am missing something basic here but I'm just not seeing it. Any help is greatly appreciated.` void Start() { trackedObj = GetComponent(); display.SetActive(false);

 }

 // Update is called once per frame
 void Update() {

     if ((SteamController.GetPressDown(gripButton) && grabCount==0 && info == null) || (OVRInput.Get(trigger,OVRInput.Controller.RTouch) == 1 && grabCount==0 && info==null))
     {
         display.SetActive(true);
         grabCount = 1;
         Debug.Log("HandPanel Activated");
     }

     if ((SteamController.GetPressDown(gripButton) && grabCount==1 && info == null) || (OVRInput.Get(trigger, OVRInput.Controller.RTouch) ==1 && grabCount==1 && info != null))
     {
         info.transform.position = GameObject.Find("HandPanel").transform.position;
         info.SetActive(true);
         info.transform.rotation = transform.rotation;
         info.transform.Rotate(20f, 0f, 0f);
         info.transform.parent = transform;
         info.transform.localPosition = new Vector3(.02f, .18f, .12f);
         WriteText();

     }
     if ((SteamController.GetPressUp(gripButton) && info == null) || (OVRInput.Get(trigger, OVRInput.Controller.RTouch) == 0 && info != null))
     {
         info.transform.parent = target.transform;
         info.transform.position = target.transform.position;
     }
     if (gameObject.transform.position.y >=0 || (OVRInput.Get(trigger, OVRInput.Controller.RTouch) ==1 && Time.deltaTime >= buttonTime && info==null) || (SteamController.GetPressDown(gripButton) && Time.deltaTime >= buttonTime && info==null))
     {
         display.SetActive(false);
         grabCount = 0;
         Debug.Log("HandPanel Deactivated");
     }
 }`
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

1 Reply

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

Answer by novavr · Sep 21, 2017 at 07:33 PM

Ok so after trying tons of ways to get this to work as an Axis1D I decided that since I don't need it to actually be an Axis1D I turned it into a RawButton which works fine now. I still have no idea why the Axis1D doesn't work here but it not longer matters.

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

188 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Unity 5 remote not working thogether with Cardboard VR 2 Answers

OVR Walking Animation trigger. 0 Answers

When I toggle off the GvrViewer the Y mouse sensivity camera look is locked 0 Answers

Switch between 5 cameras in the game by clicking. 0 Answers

How to send event to my canvas via script 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