# help needed on UVN camear

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

## 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 on other sites
Just solved my problem.thanks everyone anyway.