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 Shnyder · Nov 08, 2015 at 06:33 AM · androidinputkeyboardvirtualtouchpad

[Gear VR] moving camera - no input controls work

Hello everybody,

I can't seem to be able to get the camera moving inside my Gear VR App.

Inside the desktop environment mouse and keyboard input seem to be working fine. I'm using Unity 5.2.2f1 on an S6 Edge, have downloaded and extracted the oculus mobile sdk and have android studio working. On Android, I use a bluetooth keyboard.

I've tried these approaches so far: - mouse input button 0 for the touchpad - mouse axis for the touchpad - keyboard entry wasd and arrow keys - tried to use Oculus Utilities instead

Any ideas?

My latest collection of attempts looks like this:

 using UnityEngine;
 using System.Collections;
 
 public class CameraMovement : MonoBehaviour {
     public int button = 0;
     public float clickSize = 50; // this might be too small
     Vector3 pos;          // Use this for initialization
     void Start () {
         OVRTouchpad.Create();
         OVRTouchpad.TouchHandler += HandleTouchHandler;
     }
 
     void HandleTouchHandler(object sender, System.EventArgs e)
     {
         OVRTouchpad.TouchArgs touchArgs = (OVRTouchpad.TouchArgs)e;
         if (touchArgs.TouchType == OVRTouchpad.TouchEvent.SingleTap)
         {
             //TODO: Insert code here to handle a single tap.  Note that there are other TouchTypes you can check for like directional swipes, but double tap is not currently implemented I believe.
             /*if (Camera.current != null)
             {
                 // pos = Input.mousePosition;
                 float moveForward = 0.001f;// Input.GetAxis("Mouse X");
                 float moveUpward = 0.0f;// Input.GetAxis("Mouse Y");
                 Vector3 camVec = Camera.current.transform.TransformVector(new Vector3(0.0f, moveUpward, moveForward));
                 Camera.current.transform.Translate(camVec);
             }*/
             transform.Translate(new Vector3(0, 0, 3.5f * Time.deltaTime));
         }
     }
 
     void ClickHappened()
     {
         Debug.Log("CLICK!");
     }
 
     // Update is called once per frame
     void Update () {
 
         var speed = 3.5f;
         /*if (Input.GetMouseButtonDown(button))
         {
         if (Camera.current != null)
             {
                // pos = Input.mousePosition;
             float moveForward = 0.001f;// Input.GetAxis("Mouse X");
             float moveUpward = 0.0f;// Input.GetAxis("Mouse Y");
                 Vector3 camVec = Camera.current.transform.TransformVector(new Vector3(0.0f, moveUpward, moveForward));
                 Camera.current.transform.Translate(camVec);
             }
         }*/
         if (Input.GetKey(KeyCode.RightArrow))
         {
             transform.Translate(new Vector3(speed * Time.deltaTime, 0, 0));
         }
         if (Input.GetKey(KeyCode.LeftArrow))
         {
             transform.Translate(new Vector3(-speed * Time.deltaTime, 0, 0));
         }
         if (Input.GetKey(KeyCode.DownArrow))
         {
             transform.Translate(new Vector3(0, 0, -speed * Time.deltaTime));
         }
         if (Input.GetKey(KeyCode.UpArrow))
         {
             transform.Translate(new Vector3(0, 0, speed * Time.deltaTime));
         }
         
         if (Input.GetMouseButtonUp(button))
         {
         }
     }
 }
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 saschandroid · Nov 09, 2015 at 07:39 AM 1
Share

Are you trying to move one of the cameras (there are two) or the OVRCameraRig? I think you can't move the cameras directly because their position is updated by the OVRCameraRig.cs script and have to move the rig.

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Shnyder · Nov 13, 2015 at 05:45 PM

Edit: In the VR Overview Manual for 5.1 at "understanding the manual" it says: http://docs.unity3d.com/Manual/VROverview.html

The camera transform is overridden with the head-tracked pose. If you want to move the camera, you must attach it as a child to another game object and then move the root game object. You will need to adjust scripts that directly move the camera.

That actually brought me on the right track: I created a new project with a plane, a cube and a ball. I used the VR-Setting in 5.2 for the camera. I attached the ball to the camera and the camera to the cube. The script (without OVR-related code) was then added to the cube.

The result is that the ball sticks in front of the camera whereever I move my head, and the camera is movable with a bluetooth keyboard.

I think I'll stick with the approach of using dummy objects, as they give a simple interface while the VR SDKs might still change a lot.

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 NeeMan · Jun 29, 2016 at 04:44 PM

Excellent thanks! Helped me a lot, was really struggling to debug and profile my VR app.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make floating mobile keyboard in mobile game ? 0 Answers

Android Hardware Keyboard 0 Answers

Cross Platform Input 0 Answers

NGUI UIInput issue with some Android devices (Virtual keyboard is OK, but no letters appears on textfield) 0 Answers

Android Keyboard Text field is black on black color after unity update; how can I fix it? 1 Answer


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