• 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 bratmandu · Jul 27, 2011 at 02:18 PM · androidcameragpscompass

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

Hi,

All I need is to find out how to get the direction the Android device is pointing in, for an AR app our company is looking to develop.

I will also need to access the device camera as a background to the 3d game-world, but right now I'm just starting out.

I can access the GPS of the device, so in the 3d world of the app, I place an object at certain x/z co-ordinates (multiplied by 1000 - so 35.566754 degrees latitude in real life would be 'x' co-ordinate 35566.754 in the app 3d world), and while I can sucessfully match the 3d-world camera to the real life device position, I cannot seem to match the camera to the device direction - the camera must always look at the target object - not ideal for AR purposes.

We're just prototyping at the minute, and haven't settled on a development environment yet, but we did notice Shiva can access Android compass headings quite easily with one line, see here: http://www.stonetrip.com/developer/doc/api/system-getLastKnownHeading

So if it's that simple to get the compass bearing in Shiva, why can't Unity?

The only kind of answer to this question I've seen on Unity Answers links to here: http://answers.unity3d.com/questions/43794/compass-java-plugin-for-unity-android.html

Which doesn't really help us, as the answer is psuedocode, and a bit complex for what should be a simple task of accessing a vector heading from a part of the android device.

Can anyone shed some light on a possible solution for this, or is Shiva superior for this kind of thing?

Any help appreciated.

Bratman

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by wiserd · Aug 10, 2011 at 08:09 PM

Prime 31 just released a plugin (costs money, but not much) to expose sensor data in the Android phone. It's not up on their website yet. As someone who's been looking for the same thing, this seems to be the best solution as of this date. At least as far as I can find.

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 fherbst · Sep 06, 2011 at 03:54 PM

Prefrontal Cortex also has such a plugin in the asset store, which provides access to all sensors Android has to offer.

Forum link: http://goo.gl/8ZIM7

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity Android Inputs With Samsung Galaxy Ace 0 Answers

compass in unity3d 3.2 4 Answers

How to use Android Accelerometer(Left and right tilt) to turn a sphere object and camera in that direction? 1 Answer

ARCamera does not move with the phone 0 Answers

perspective camera into android 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