Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have referred to an application for interactive rotation in 3D space. The same is uploaded on youtube for your reference. I am having difficulty in understanding the rotation of the axis. In the reference app, axis of model moves in bernoulli's lemniscate path. When we swipe horizontal or vertical, it rotates complete 360 degrees however when the angle of swipe is changed (not exactly parallel to X-axis or Y-axis) model's axis moves in lemniscate path and comes back to starting position.

I am not abel to understand the concept and functioning behind this action. I am really stuck and have tried really hard to understand but failed. I will be obliged if anyone helps me understand this.

share|improve this question

closed as too localized by Byte56, Anko, Nicol Bolas, bummzack, Josh Petrie Jun 5 '13 at 14:09

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Looks like the model just rotates around the Y or X axis of the camera's view when the rotation starts. I think this question is a bit too localized for the site however. – Byte56 Jun 1 '13 at 13:16

Looks to me like the horizontal component of the swipe adjusts camera yaw angle and the vertical component adjusts camera pitch angle. There's no special handling for diagonal swipes; they're just a combination of horizontal and vertical.

Yaw is rotation in the ground plane; an angle offset from North or whatever. Pitch is an angle offset above/below the horizon. The camera is yawing and pitching around a lookat point a foot or so in front of the guy's pelvis. The camera is offset maybe 8 feet from that point and always looks at it.

You can compute a camera transform from the lookat point, offset distance, yaw, and pitch. Just google this. The up vector for the camera transform is calculated from the world-space up vector. (Except when pitch is near +/- 90 degrees; there, you must instead compute your camera up vector from the yaw direction in the ground plane.)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.