> On Oct 27, 2014, at 10:03 AM, William Squires <wsqui...@satx.rr.com> wrote:
> 
> I'm trying to write a simple demo app and need to know two things:
> 
> 1) How can I translate the output from the accelerometer into an angular 
> deflection from the x- or y-axis (if you think of the device as an airplane, 
> with the cockpit near the FaceTime camera, and the tail near the home button, 
> then the long axis of the phone is the y-axis (roll), and the semi-long axis 
> is the x-axis (pitch). I don't care about yaw, or rotation about the z-axis, 
> which points into and out of the device). I need to get the angle, theta, 
> when - for example - there's a 1 degree pitch down. This way, I can move the 
> light source for rendering by that angle off the z-axis.
>  So, for the above example, when I pitch down the device 1 degree, with the 
> light source originally @ (0, 0, z), then the distance (in cm, or whatever) 
> that the front edge of the phone dips below the x-y plane is some value 'q' - 
> then I can make the new light source vector (0, q, z), and the angle between 
> this new vector and the original one is 1 degree. Likewise, if I pitch up 1 
> degree, then the new lighting (position) vector would be (0, -q, z). What I 
> don't know are what units the accelerometer is giving me? (meters per sec sq? 
> centimeters/s^2? millimeters? 1/10ths of an inch? or is it a percentage of 
> 'g'=-9.81m/s^2 here on Earth, anyway?)

You should use CoreMotion’s device motion when available, as this uses the 
gyroscope built into many devices since the iPhone 4. You may be able to fake 
somethings with the accelerometer, but it will likely be much harder.

> 2) Is OpenGL(ES) fast enough for rendering material effects (like shining a 
> light source on a shiny piece of (simulated) aluminum panel)? Or should I 
> rely on a pre-rendered texture atlas? I assume the new "Metal" (in iOS 8) 
> will be, but I want to target iOS 7 as well.

In general this question is going to cut more to the scene you are rendering 
and the underlying graphics chip. But its hard to know ahead of time without 
knowing how complex your scene will actually be.

> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to