Thoughts from a NeXTStep Guy on Cocoa Development

Using the TrackBall

Oct 19, 2008 by Bill Dudney

So I had several pings on twitter yesterday on getting a simple example in place. So since I could not sleep this AM anyway I spent a few minutes putting one such example together. Here is a screen shot of the initial scene. Looks simple enough, two images both in layers contained in a third layer. Straightforward enough.

Just to make things interesting I put a small rotation around the X axis on each of them. Of course you can't see that right now because we are looking straight down the Z axis and the rotation is not enough to distort the images. But what happens if you move around the scene via the trackball from my last post. Well you can see the 3D nature of the scene of course :)

I placed the code here. This is one of the examples I'll be talking about @iPhoneLive, hope to see you there! And if you are really spontanious, would be great to have you @CSS where I have 90 minutes to talk CA and CA alone.

Happy hacking!


I've made an app using your TrackBall code.


Posted by wookay on October 20, 2008 at 04:26 AM MDT #

Cool stuff!

Posted by Bill Dudney on October 20, 2008 at 06:13 AM MDT #

Has anyone taken this same approach and applied it to OpenGL?

Posted by Duane Fields on August 19, 2009 at 11:14 AM MDT #


I got the code from an OpenGL example on NeHe ( pages.

I will try to create another example using OpenGL and post that.

Posted by Bill Dudney on August 19, 2009 at 11:20 AM MDT #


Thanks a lot for your excellent code snippet without using OpenGL. It really helps me. if you can help me i also want to bounce the layer in up/down direction like jumping up/down.

If you have idea how to achieve functionality this please update me.

Thanks In Advance.

Posted by Jaydev gohil on May 26, 2011 at 10:14 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed