views:

1219

answers:

1

Hi, I am experimenting a bit with the iPhone 3GS and its magnetic sensors. It is quite simple to get the heading and the angle of the north pole seen from the top of the device. Also getting the position of the device itself via accelerometer is quite easy. But getting it all together deserves some math knowledge regarding vector calculations I guess.

So what I am interested in is a quite simple way to do those calculations and apply them to an UIView that I put into my camera overlay. For example I would like to fixate a UIView at the north pole on the horizon. This should also work when I tilt and rotate the device. Great would also be if a 'transform' could be applied to the UIView so it is rotated to always show up.

Another thing which would be needed might be to get the correct relations between the camera view field and the object coordinates. If these match exactly in theory the object should stick and overlay always the same objects in reality if the person does not move.

Any samples? Any ideas? Any code not using OpenGL ;) Thanks.

+3  A: 

Might want to take a look at ARKit.

Ramin
Cool. This looks very promising. I'll have a closer look at it. Thanks.
Holtwick
I had a look at it and it is quite cool. But it still misses some calculations e.g. if you change the angle of your device from landscape to portrait. But anyways, it is a very good starting point. Thanks. PS: The project seems to have moved to GitHub now. Find it here http://github.com/zac/iphonearkit
Holtwick
AFAIK, it started as a weekend hack at the most recent iPhoneDevCamp. It was pretty impressive for how much they got done in such a short amount of time. They put it out there mostly as a starting point for people to play with and help make better.
Ramin