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 /
avatar image
0
Question by Ewan Blackburn · Mar 11, 2013 at 07:45 PM · androidgpscompasstabletunity android

Unity Android Inputs With Samsung Galaxy Ace

Hi,

Im working with Unity android pro to create an augmented reality system that uses the compass, GPS and accelerometer to manipulate the location of a camera in 3D space.

To est this system im using the unity android remote ( i know this works because the game view is visible on the tablet and i can interact with GUI interfaces)

My issue is that after attaching a script to change the camera angle in the y axis in relation to the compass value all that happens is the compass magnetic heading says its '0' and does not change.

Is there an issue with my code (below) or is there an issue with unity compatibility accessing my input sensor values?

In the code I currently have all GPS code commented out

 #pragma strict
 
 var Yofset : float = 0;
 var XrotOfset : float = 0;
 
 var xaxis : float = 0;
 var yaxis : float = Yofset + 0;
 var zaxis : float = 0;
 
 var anglex : float =XrotOfset + 0;
 var angley : float = 0;
 var anglez : float = 0;
 
 var compassHeading : float ;
 
 var lat : float = 0;
 var lon : float = 0;
 var alt : float = 0;
 var accuracy : int =10;
 var distance : int = 10;
 var maxWait : int = 20;
 var locationStatus : int =0;
 
 
 function Start () 
 {
     Input.location.Start();
     Input.compass.enabled = true;
     //locationStatus = LocationServiceStatus.Stopped;
 
     //startLocationService(); 
 }
 
 function Update () 
 {
     
     compassHeading = Input.compass.trueHeading;  
 
     Camera.main.transform.position= Vector3( xaxis, yaxis, zaxis);
     Camera.main.transform.eulerAngles = Vector3(anglex, compassHeading, anglez);
 
    /* if(locationStatus == LocationServiceStatus.Running)
     {
         
         lat = Input.location.lastData.latitude;
         lon = Input.location.lastData.longitude;
         alt = Input.location.lastData.altitude;
         
        print(lat);
        print(lon);
        print(alt);
        
     } */
 }
 
 /*function startLocationService()
 {
     Input.location.Start(accuracy, distance);
     
 
     while(Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) 
     {
         WaitForSeconds(1);
         maxWait--;
        locationStatus = Input.location.status;
     }
 } */

Cheers in advance

Comment
Add comment · Show 2
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 DaveA · Mar 11, 2013 at 07:48 PM 0
Share

Try moving a magnet around the device. Are you sure this is supposed to work in Remote, have you tried running it just on the tablet?

avatar image Ewan Blackburn · Mar 11, 2013 at 11:22 PM 0
Share

cheers dave that worked! just a shame i cant use the remote and have to build to device every time i get a piece of code to actually compile!

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

11 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

Related Questions

GPS Application with Unity Android 1 Answer

compass in unity3d 3.2 4 Answers

Android Tablet GPS not working 0 Answers

Is there no simple way to get a device heading in Android with Unity? 2 Answers

GPS doesn't work in AGPS mode 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