|
i want to build a simple (real) compass. for that i must know the angle relative to magnetic north to rotate my compass on Y axe... iOS has magneticHeading that is exactly what i need LINK HERE is there any similar way to do tha same thing in unity or is possible to pass a magneticHeading from xcode as a variable to unity?
(comments are locked)
|
|
What you are looking for is "magnetic declination". Here's a map showing its dependence on location: http://en.wikipedia.org/wiki/File:Mv-world.jpg (simple version: http://en.wikipedia.org/wiki/File:IGRF_2000_magnetic_declination.gif ) Here's an online tool: http://www.ngdc.noaa.gov/geomagmodels/struts/calcDeclination Here's some Fortran code which does the job :-D http://www.ngdc.noaa.gov/IAGA/vmod/igrf11.f I don't think that's what he means. He is referring to the built in compass on the iPhone which has public apis that devs can use in their apps to get location and direction. He wants to know how to access that in Unity.
Aug 17 '10 at 01:16 AM
Peter G
Oh I interpreted his question the wrong way, I thought he actually tried to find the different between true north and magnetic north, as part of an advanced compass, but he just wants to access the normal iPhone compass.
Aug 17 '10 at 11:47 AM
Wolfram
OMG, it is the first time I look on Fortran code... Awful ! (I know useless comment...)
Nov 02 '10 at 09:08 PM
Guillaume
(comments are locked)
|
|
thanks for you response Wolfram, i find very interesting the links from you but i don't want to build a so real compass.. :P by real i mean a real iphone compass that is pointing to the real world north and not an ingame compass that is pointing to a game world north... i stil don't have a solution, so, any help is welcome... Don't post comments as answers.
Aug 17 '10 at 02:03 AM
Eric5h5
I don't have a script, but yes, you can make a native call to output the compass value. See the Unity iPhone manual for doing that. You found the reference so all's you need to do is write an obj-c file that reads the compass, then link it to your Unity project which is all explained in the Unity iPhone manual and example on that page.
Aug 17 '10 at 02:37 AM
Peter G
wich page is that? the "Plugins - Pro only feature" page?
Aug 17 '10 at 10:10 AM
hyper
Prime31 just came out with a plugin for Sensor data. I just found out from an email they sent. As of today, it's not on their website.
Aug 10 '11 at 08:20 PM
wiserd
(comments are locked)
|

You should be able to. See the documentation page on native calls and using objective-c. I can't link to it hear.