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 NextWorldVR · Mar 14, 2018 at 08:21 AM · scripting problemoculus

Asked for help (@ Oculus) , Got sent a script. Doesn't do anything. Single sentence of instruction didn't help.

I am SIMPLY trying to MOVE an OBJECT with the OCULUS TOUCH CONTROLLERS. Using 3-axis control, Roll/Pitch?Turn,.. After a year of asking finally someone on the OCULUS site sent the following script and said as the only instruction:

"Attach to game object, select handedness, run."

It took forever to get to work, AND THEN ONLY CHANGES NUMBERS IN THE INSPECTOR!! THAT'S NOT FLYING!! :) :O ..

Here is the 'script' as posted.... and the the steps I took below:

using System.Collections; using System.Collections.Generic; using UnityEngine; public class InputEx : MonoBehaviour {

 public float TriggerVal;
 public float GripVal;
 public Vector2 ThumbStickVal;

 public bool IsPoint;
 public bool IsThumbsUp;

 public enum handedness
 {
     None = 0,
     Left =1,
     Right =2,
 }
 public handedness Handedness;
 private OVRInput.Controller m_controllerMask;

 void Start()
 {
     if (Handedness == handedness.Left) {
         m_controllerMask = OVRInput.Controller.LTouch;
     }

     if (Handedness == handedness.Right) {
         m_controllerMask = OVRInput.Controller.RTouch;
     }
 }

 void Update () {
     AnalogInputUpdate ();
     DigitalInputUpdate ();
 }
 
 void AnalogInputUpdate()
 {
     if (Handedness == handedness.Left) {
         TriggerVal = OVRInput.Get (OVRInput.RawAxis1D.LIndexTrigger);
         GripVal = OVRInput.Get (OVRInput.RawAxis1D.LHandTrigger);
         ThumbStickVal = OVRInput.Get (OVRInput.Axis2D.PrimaryThumbstick);
     }
     else if (Handedness == handedness.Right) {
         TriggerVal = OVRInput.Get (OVRInput.RawAxis1D.RIndexTrigger);
         GripVal = OVRInput.Get (OVRInput.RawAxis1D.RHandTrigger);
         ThumbStickVal = OVRInput.Get (OVRInput.Axis2D.SecondaryThumbstick);
     }
 }

 void DigitalInputUpdate()
 {

     //capacitive point and thumbs up
     IsPoint = !(OVRInput.Get (OVRInput.Touch.PrimaryIndexTrigger, m_controllerMask));
     IsThumbsUp = !OVRInput.Get(OVRInput.NearTouch.PrimaryThumbButtons, m_controllerMask);

     //digital buttons down
     if (OVRInput.GetDown (OVRInput.RawButton.X , m_controllerMask)) {
         Debug.Log ("X Down");
     }
     if (OVRInput.GetDown (OVRInput.RawButton.Y , m_controllerMask)) {
         Debug.Log ("Y Down");
     }
     if (OVRInput.GetDown (OVRInput.RawButton.A , m_controllerMask)) {
         Debug.Log ("A Down");
     }
     if (OVRInput.GetDown (OVRInput.RawButton.B , m_controllerMask)) {
         Debug.Log ("B Down");
     }
     if (OVRInput.GetDown (OVRInput.RawButton.Start , m_controllerMask)) {
         Debug.Log ("Menu Button Down");
     }

     //digital buttons up
     if (OVRInput.GetUp (OVRInput.RawButton.X , m_controllerMask)) {
         Debug.Log ("X Up");
     }
     if (OVRInput.GetUp (OVRInput.RawButton.Y , m_controllerMask)) {
         Debug.Log ("Y Up");
     }
     if (OVRInput.GetUp (OVRInput.RawButton.A , m_controllerMask)) {
         Debug.Log ("A Up");
     }
     if (OVRInput.GetUp (OVRInput.RawButton.B , m_controllerMask)) {
         Debug.Log ("B Up");
     }
     if (OVRInput.GetUp (OVRInput.RawButton.Start , m_controllerMask)) {
         Debug.Log ("Menu Button Up");
     }
 }

}

========================================================================================================================================================================

Here is what I did with this mysterious unexplained, un- 'commented' script:

1) I create a New Unity Project and import Oculus Utilities.

2) I create a cube, I drag in OVR Camera Rig make it a child of the cube..

3) I select Cube, add component New Script and paste in your text in Visual Studio. I save the file as fly.cs

4) I set player setting for VR Enabled and Oculus (No open VR)

5) I run the game window, try every single button and grips etc on each oculus controller, Nothing at all,.

So, That's where i'm at, I look at the Cube inspector, it does say at the top of the Script Component entry 'NOTHING SELECTED' (???) The CUBE IS SELECTED!! The errors I get are:

1) The referenced script on this Behaviour is missing! (referenced Script? I only have one Script and it's fly.cs ... It is Definately in the Project Folder, That where I created it, as you can see above, I addeda 'new script' the the cube, then saved it in Assets/Scripts)

2) The referenced script on this Behaviour (Game Object 'Cube') is missing!

WHAT is the 'Referenced Script'? I only HAVE one SCRIPT,.. I will attach a screen grab, of the Inspector and the Console,. alt text

Thank you for any help.

damn-unity.jpg (484.0 kB)
Comment
Add comment · Show 1
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 b1gry4n · Mar 14, 2018 at 01:06 AM 0
Share
 InputEx : $$anonymous$$onoBehaviour

if your script is named fly, it needs to be

 fly : $$anonymous$$onoBehaviour

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

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

Related Questions

Checking if canvas world space is visible in CenterEyeAnchor? 0 Answers

Why does my gameObject's functionality change after exiting and reentering scene? 0 Answers

What is the best way to play with the rotation of Oculus' OVRPlayerController? 1 Answer

Unity Interactive Tutorials Scripting Problem 0 Answers

SmoothDamp in my FPS controller. Does not feel like it is working. 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