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 benjano · Jul 04, 2017 at 05:13 AM · unity 5

'OVRInput' could not be found

Please this error is driving me INSANE!! And I can't figure out how does it work. I know there are millions of topics, but there are no explanations and all are different.

This is my case:

 Assets/OvrAvatar/Scripts/OvrAvatarLocalDriver.cs(15,36): error CS0246: The type or namespace name `OVRInput' could not be found. Are you missing an assembly reference?


 using UnityEngine;
 using System.Collections;
 using System;
 using System.Collections.Generic;
 using Oculus.Avatar;
 using UnityEngine.UI;
 
 
 public class OvrAvatarLocalDriver : OvrAvatarDriver {
 
     private const float mobileBaseHeadHeight = 1.7f;
 
     float voiceAmplitude = 0.0f;
     ControllerPose  GetControllerPose(OVRInput.Controller controller)
     {
         ovrAvatarButton buttons = 0;
         if (OVRInput.Get(OVRInput.Button.One, controller)) buttons |= ovrAvatarButton.One;
         if (OVRInput.Get(OVRInput.Button.Two, controller)) buttons |= ovrAvatarButton.Two;
         if (OVRInput.Get(OVRInput.Button.Start, controller)) buttons |= ovrAvatarButton.Three;
         if (OVRInput.Get(OVRInput.Button.PrimaryThumbstick, controller)) buttons |= ovrAvatarButton.Joystick;
 
         ovrAvatarTouch touches = 0;
         if (OVRInput.Get(OVRInput.Touch.One, controller)) touches |= ovrAvatarTouch.One;
         if (OVRInput.Get(OVRInput.Touch.Two, controller)) touches |= ovrAvatarTouch.Two;
         if (OVRInput.Get(OVRInput.Touch.PrimaryThumbstick, controller)) touches |= ovrAvatarTouch.Joystick;
         if (OVRInput.Get(OVRInput.Touch.PrimaryThumbRest, controller)) touches |= ovrAvatarTouch.ThumbRest;
         if (OVRInput.Get(OVRInput.Touch.PrimaryIndexTrigger, controller)) touches |= ovrAvatarTouch.Index;
         if (!OVRInput.Get(OVRInput.NearTouch.PrimaryIndexTrigger, controller)) touches |= ovrAvatarTouch.Pointing;
         if (!OVRInput.Get(OVRInput.NearTouch.PrimaryThumbButtons, controller)) touches |= ovrAvatarTouch.ThumbUp;
 
         return new ControllerPose
         {
             buttons = buttons,
             touches = touches,
             joystickPosition = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, controller),
             indexTrigger = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, controller),
             handTrigger = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, controller),
             isActive = (OVRInput.GetActiveController() & controller) != 0,
         };
     }
 
     private PoseFrame GetCurrentPose()
     {
         Vector3 headPos = UnityEngine.VR.InputTracking.GetLocalPosition(UnityEngine.VR.VRNode.CenterEye);
 #if UNITY_ANDROID && !UNITY_EDITOR
         headPos.y += mobileBaseHeadHeight;
 #endif
 
         return new PoseFrame
         {
             voiceAmplitude = voiceAmplitude,
             headPosition = headPos,
             headRotation = UnityEngine.VR.InputTracking.GetLocalRotation(UnityEngine.VR.VRNode.CenterEye),
             handLeftPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch),
             handLeftRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch),
             handRightPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch),
             handRightRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch),
             controllerLeftPose = GetControllerPose(OVRInput.Controller.LTouch),
             controllerRightPose = GetControllerPose(OVRInput.Controller.RTouch),
         };
     }
 
     public override void UpdateTransforms(IntPtr sdkAvatar)
     {
         if (sdkAvatar != IntPtr.Zero)
         {
             PoseFrame pose = GetCurrentPose();
 
             ovrAvatarTransform bodyTransform = OvrAvatar.CreateOvrAvatarTransform(pose.headPosition, pose.headRotation);
             ovrAvatarHandInputState inputStateLeft = OvrAvatar.CreateInputState(OvrAvatar.CreateOvrAvatarTransform(pose.handLeftPosition, pose.handLeftRotation), pose.controllerLeftPose);
             ovrAvatarHandInputState inputStateRight = OvrAvatar.CreateInputState(OvrAvatar.CreateOvrAvatarTransform(pose.handRightPosition, pose.handRightRotation), pose.controllerRightPose);
 
             CAPI.ovrAvatarPose_UpdateBody(sdkAvatar, bodyTransform);
             CAPI.ovrAvatarPose_UpdateHands(sdkAvatar, inputStateLeft, inputStateRight);
         }
     }
 }

Why?? Please explain the theory behind it! Thanks!

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by samra2494 · Feb 07, 2019 at 07:07 AM

Hi, Please download and import this package in your project. all errors will be gone. i have tried this and it works good for me. https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022

Comment
Add comment · Show 1 · 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 MrStreakman · Nov 19, 2020 at 12:47 PM 0
Share

This still works for me as of Unity 2019.4.10f1! The other responses from 2017 are obsolete.

avatar image
1

Answer by Vicarian · Jul 04, 2017 at 06:30 AM

There isn't a theory. It's Computer Science. You're simply missing a package that exposes the type OVRInput (it's a symbol that gets added to a symbol table for parsing by a compiler, etc.) OVRInput (which you get by downloading the Oculus Unity Runtimes) never got added to the symbol table. Since it's off in the ether somewheres, the C# compiler alerts you that it found an unexpected symbol and throws CS0246. Go hop on Oculus's Dev site and get those sweet, succulent unitypackages.

https://developer.oculus.com/downloads/package/oculus-utilities-for-unity-5/

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 DHARMAKAYA · Sep 24, 2017 at 01:16 AM

Considering that the oculus utilities has a bunch of errors, seemingly because facebook has a 3rd world labor sweatshop of 3rd world programmers that facebook hires on the cheap via the horrible h1b visa scam, that answer is relatively useless. I imagine the op CERTAINLY WOULDN'T want to run a while loop without a break statement while executing the trouble shoot.

Comment
Add comment · Show 1 · 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 Vicarian · Sep 24, 2017 at 01:21 AM 0
Share

I have no issues with the Oculus Utilities. I don't quite know what you're even talking about, and sounds as if you're biased against Facebook. There isn't even a while loop in the source the OP posted. If the OP wants OvrAvatar to work, it requires the Oculus Utilities, end of story.

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

131 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

Related Questions

Error :Currently selected backend ill2ccp not installed (UWP) 0 Answers

How to add a Animator Controller to a character at runtime? 0 Answers

Keyboard input works in editor, but not when built 0 Answers

Unity GUI Font Size changes with the screen resolution Problem 1 Answer

Help with destroying Clone of Instantiated 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