real north for a simple compass

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?

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

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...