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 AnameNoUnelseHas · Jul 29, 2018 at 10:01 PM · oculus rift

Help Keymapping to Oculus Rift Hand Controller

I have this code below which switches between a first person and third person cameras for a player and currently it maps to the G key on the keyboard. I wish it to map to the left Oculus controller X button. I do NOT know how to do this. Help? Advise? I have looked through the Oculus and Unity pages for documentation and looked at the sample scripts in the VR samples without success and I please need help. I have donuts and coffee to offer as trade.... ; ) Thanks!

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class CamSwitcher : MonoBehaviour {
 
     public Camera FpsCam;
     public Camera TpsCam;
     bool fpsCam = true;
 
 
     void Start () {
         FpsCam.enabled = FpsCam;
         TpsCam.enabled = !fpsCam;
     }
 
     // Update is called once per frame
     void Update()
     {
         if (Input.GetKeyDown(KeyCode.G))
         {
             fpsCam = !fpsCam;
             FpsCam.enabled = FpsCam;
             TpsCam.enabled = !fpsCam;
 
 
         }
     }
 }
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by gerhardfunk · May 31, 2019 at 11:44 PM

Theoretically you should simply replace in line 20

 if (Input.GetKeyDown(KeyCode.G))

by

 if (OVRInput.GetDown(OVRInput.RawButton.X))

or whatever input read method or button you like. Just look it up here: https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/

I say "theoretically" because I'm quite a noob just staring to build my first rudimentary setups for an art project using oculus rift in unity and this simple input method, which SHOULD be working, does not work. The rift's controller buttons are dead even in the sample scenes of the sample framework delivered with the current verson (ver. 1.37) of the "oculus integration" asset from the asset store. That's why I'm here answering to an almost one year old question :/ @AnameNoUnelseHas the coffee is cold by now, right? anyone else having dead oculus rift buttons recently? ,theoretically you should just replace

 if (Input.GetKeyDown(KeyCode.G))

by

 if (OVRInput.Get(OVRInput.Button.One))

or

 if (OVRInput.GetDown(OVRInput.Button.One))

whatever you need, look all the options up under the oculus documentation here: https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/

i say "theoretically" because I am quite a noob just starting my first experiments with oculus in unity and right now this simple input read method, which SHOULD be working, seems not to be working anymore.

probably because the current oculus implementaion from the asset store is outdated for unity 2019 (which is not really a prob, since you can use older versions), but probably because the oculus rift app update from couple of days ago is not compatible with the current implementaion from the asset store anymore.. that's why i'm here :/ that's why i'm replying to a question, wich is almost a year old...

anyone else having issues with dead rift controller buttons in unity?

@AnameNoUnelseHas the coffee is cold by now, right?

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 wave-rider · Oct 06, 2021 at 04:25 AM

@gerhardfunk if (OVRInput.GetDown(OVRInput.RawButton.X)) worked perfectly fine for me Thanks for posting your suggestion

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

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

Oculus DK2 : How do I exit the VR player? 1 Answer

oculus rift input problem doesnt print 1 i have the latest version of oculus utilities i got the ovrInput and its suppose to work but it doesn't work someone got an idea what is the problem? 0 Answers

oculus DK2 stopped working with unity on windows 7 1 Answer

How to move a player to a set position in vr 0 Answers

Oculus Rift Positional Tracking not working in Unity 5 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