File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes Angles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Angles" Watch "Angles" New topic
Author

Angles

Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
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.


I've heard it takes forever to grow a woman from the ground
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
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

Joined: Apr 04, 2004
Posts: 815
In case anyone's curious, here's the correct method:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Angles
 
Similar Threads
drawing arrows
Circular motion.......
Drawing/moving problem: how to define destination? (code included)
Picking With Java 3D
Rotating Squares in java