Advertisement Jump to content
Sign in to follow this  

help needed on UVN camear

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a wire frame engine using UVN camera at the moment. Basically I am sure my camera algorithm is correct because I have got it from a book. At the moment I have got it into a stage where it is working for transformation, but rotation always gives me a weird result.and I have narrow it down to compution of the target vector. here is the source.

float phi = _direction.x;
float theta = _direction.y;

float sinPhi = SinFast(phi);
float cosPhi = CosFast(phi);

float sinTheta = SinFast(theta);
float cosTheta = CosFast(theta);
float r = 1 * cosPhi;
if(r < 0)
    r = r*-1;

_target.x = r * sinTheta;   
_target.y = 1 * sinPhi;
_target.z = r * cosTheta;
_target.w = 1;	

Above code makes the camear rotate but only in very small portion per degree I have changed in control. In debugging, I have found out that all three components of the target vector are very small. so I have tried to change the spherical unit i.e. the 1 to something big like 1000. This makes it rotate in big portion per degree,but still it doesnt provide the correct result. Can anyone give me some suggestion where I have done wrong please? Thanks in advance. [Edited by - jimywang on May 15, 2005 8:14:38 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!