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 Arsandis · Nov 08, 2018 at 10:06 AM · scripting problemmovementvroculusmove an object

Unity for OculusGo: Move an object along the z axis by touchpad

I have written a script to pick an object with a rigidbody component by the ray casted from the controller and move it around. I make the object, the child of the controller to move it in the scene then. I already have a script to detect the object by the ray casted from a controller, picking it up and moving it up and down and left and right with the controller.

Now , I want to make that selected object along the z-axis by using the touchpad of oculus go. However I am not sure how to do it. This is the function i am using it to attach to the parent:

  public virtual void Store(Transform NewParent)
     {
         //The following stops the object being effected by physics while it's in the players hand
         rb.isKinematic = true;
         //And fixes it to the new parent it is given by the player script to follow.
         transform.parent = NewParent;
         //It then resets it's position and rotation to match it's new parent object
         //transform.localRotation = Quaternion.identity;
         //transform.localPosition = Vector3.zero;
     }


and then i use it in the pointer class to attach it to the ray:

 void Intract()
     {
         //We set up the input "OculusPrimaryIndexTrigger" in the Input manager
         if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
         {
             selectVisual.ClearObject();
             //Check if you are holding something you can throw first
             if (inHand != null)
             {
                 inHand.Release(controllerRef.forward, throwForce);
                 inHand = null;
                 //We do this check here to prevent Errors if you have nothing selected
             }
             else if (selectedObject != null)
             {
                 //Check if you can pick up the selected object second
                 if (selectedObject.GetComponent<PickUp>())
                 {
                     //Beacuse PickUp is a child of PropBase, we can ask InHand to store selectedObject as PickUp, rather than use GetComponent
                     inHand = selectedObject as PickUp;
                     inHand.Store(holdingRef);
                     //If non of the above were valid then simple call the trigger function of the selected object
                 }
                 else
                 {
                     selectedObject.Trigger();
                 }
             }
             //If you have a object that you need to hold down a button to intract with
         }
        
         else if (pointerOver != null)
         {
             if (pointerOver.GetComponent<PropBase>())
             {
                 selectedObject = pointerOver.GetComponent<PropBase>();
             }
             else
             {
                 selectedObject = null;
             }
         }
         else
         {
             selectedObject = null;
         }
 
     }
 
 }


If anyone could point me in a right direction or help me with this, I would greatly appreciate it!

Thanks in advance.

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

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

237 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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 VR Drag Slider With Finger 0 Answers

[Oculus SDK] How to add colliders to OVRGrabbable at runtime? 2 Answers

Movement with Oculus Go 0 Answers

Does Oculus Go still require importing Oculus libraries? 0 Answers

How to stop a video using the OCULUS script MoviePlayerSample.CS. 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