# Camera

This topic is 4706 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm creating a Camera class using equations like the one in here. I've noticed if you rotate too much on the X axis (look up/down), the world gets distorted and stretches out and zooms away. Why is this happening, and is there a way to fix it? Also, if you set the position and view to (0, 0, 0), the camera won't work. Why?

##### Share on other sites
I think some of the code in that tutorial may be wrong (although I'd have to look more carefully to be sure). You might try the following:
void RotateCamera(double Angle, double x, double y, double z){  quaternion temp, quat_view, result;  temp.x = x * sin(Angle/2);  temp.y = y * sin(Angle/2);  temp.z = z * sin(Angle/2);  temp.w = cos(Angle/2);  quat_view.x = View.x-Position.x; // Changed this line  quat_view.y = View.y-Position.y; // Changed this line  quat_view.z = View.z-Position.z; // Changed this line  quat_view.w = 0;  result = mult(mult(temp, quat_view), conjugate(temp));  View.x = result.x+Position.x; // Changed this line  View.y = result.y+Position.y; // Changed this line  View.z = result.z+Position.z; // Changed this line}
However, I wouldn't recommend basing your camera on that tutorial. I can elaborate if you like, but I'd just be repeating things that have already been said in numerous threads recently...

##### Share on other sites
That's the way I had it originally, but it still does what I said. I think I found your post I'm gonna go read it. Thanks

1. 1
2. 2
Rutin
21
3. 3
A4L
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633741
• Total Posts
3013624
×