Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Quazar_100 · Jun 11, 2015 at 10:44 AM · android

ALPSVR Camera Roll & Yaw

Hi,

It's now some days I'm struggling with it, as the title says, I just want the gyro when tilting & yawing to rotate correctly in between some limits (-90° Y -> +90° Y, -60° X -> +60° X, -45° Z -> +45° Z).

For now, it's just moving forward & also keeps rotating, only when you keep your head rotating on itself, so it's not practical, in a situation were we sit on a chair.

 /************************************************************************
     ALPSNavigation provides an input-free navigation system
     
     Copyright (C) 2014  ALPS VR.
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 3 of the License, or
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 ************************************************************************/
 
 using UnityEngine;
 using System.Collections;
 
 //[RequireComponent (typeof (CharacterController))]
 [System.Serializable]
 public class ALPSNavigation : MonoBehaviour {
 
     //=====================================================================================================
     // Attributes
     //=====================================================================================================
 
     /**Public**/
     public static float pitch;
     public static float yaw;
     public static float roll;
 
     public float speed = 3;
     public int vibration = 20;
 
     public float forwardLowerBound     = 20;
     public float forwardUpperBound     = 30;
     public float forwardLimit         = 50;
     public float backwardLowerBound = 20;
     public float backwardUpperBound = 30;
     public float backwardLimit         = 50;
 
     public static float ForwardLowerBound;
     public static float ForwardUpperBound;
     public static float BackwardLowerBound;
     public static float BackwardUpperBound;
     public static float ForwardLimit;
     public static float BackwardLimit;
 
     /**Private**/
     //private CharacterController controller;
     private bool moving;
     private GameObject head;
     
     private Transform target;
 
 
     //=====================================================================================================
     // Functions
     //=====================================================================================================
 
     /// <summary>
     /// Initializes navigation system.
     /// </summary>
     public void Start () {
 
         ForwardLowerBound = forwardLowerBound;
         ForwardUpperBound = forwardUpperBound;
         BackwardLowerBound = 360 - backwardLowerBound;
         BackwardUpperBound = 360 - backwardUpperBound;
         ForwardLimit = forwardLimit;
         BackwardLimit = 360 - backwardLimit;
 
         //controller = this.GetComponent ("CharacterController") as CharacterController;
         head = GameObject.Find ("ALPSHead");
 
         if (Application.platform == RuntimePlatform.Android) {
             moving = false;
         }
 
         target = head.transform;
     }
 
 
     /// <summary>
     /// Updates navigation state.
     /// </summary>
     public void Update () {
 
         if (!moving){
             moving = true;
         }
 
         print ("Rotation : " + target.rotation);
 
         pitch = head.transform.eulerAngles.x;
         print ("Pitch : " + pitch);
         
         yaw = head.transform.eulerAngles.y;
         print ("Yaw : " + yaw);
 
         //roll += Input.GetAxis("Roll");
         roll += head.transform.eulerAngles.z;
         print ("Roll : " + roll);
 
         head.transform.Translate(Vector3.forward * Time.deltaTime * speed);
 
     }
 
     /// <summary>
     /// Initialize Android ALPS Activity.
     /// </summary>
     public static float Progress(){
         if (pitch >= ForwardLowerBound && pitch <= ForwardUpperBound || pitch >= BackwardUpperBound && pitch <= BackwardLowerBound) {
             return 1f;        
         } else {
             if(pitch>=0 && pitch < ForwardLowerBound) return pitch/25f;
             else if(pitch<=360 && pitch > BackwardLowerBound)return (360-pitch)/25f;
             else if(pitch>ForwardUpperBound && pitch <= ForwardLimit)return (ForwardLimit-pitch)/25f;
             else if(pitch<BackwardUpperBound && pitch >= BackwardLimit)return (pitch-BackwardLimit)/25f;
             else return 0f;
         } 
     }
 }
 
 
     

It's a free VR SDK for VR : ALPSVR

Thanks in advance for any advice & help !

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

2 People are following this question.

avatar image avatar image

Related Questions

android terrain textures problem 2 Answers

Android Remote Unty 3.4 2 Answers

Why SetActive Game Objects generate too much Garbage in the profiler? 1 Answer

Photon refusing connection on Android 0 Answers

How do you make falling text? 4 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