• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Angles

 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Say there is a camera at (-3,-3,3) in 3d space. We want this camera to point at the origin. If I rotate on the x-axis by 45 degrees (in right-handed space), the x-axis is dead center. If I rotate by -45 degrees (in RH space) on the y-axis, the y-axis is dead center. If I rotate both the x-axis by 45 degrees and the y-axis by 45 degrees, y-axis is correctly centered, but the x-axis seems a bit low, maybe 2/3 down the screen. This could be a problem specific to OpenGL, or specific to my code, but maybe there's a general explanation as to why this happens in 3d space.

it's driving me bat-shit.

For the sake of completeness, my method in Camera is as follows:



One problem I've just discovered about this method is that in a situation where z is negative, both xrot and yrot will "turn around" to look at it, leading to bad angles. I'll takle this once I figure out why a simple angle's not looking right.
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh! Once I've looked up on the x-axis, the triangle for the y-axis is change in x and the hypotenuse of the x-rotation triangle!
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In case anyone's curious, here's the correct method:

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic