Camera
Well - the question (don''t know if the answer is even)
what is wrong with my camera - it keeps moving into one direction even when I rotated it.
I think it''s one of those errors which are so simple that they can''t be spotted - but I think some of you might even know that problem so please help !
I hate signatures !!!
Post your camera code, so we can help you .
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
code follows :
the mistake was here
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION : Camera::Update
//
// PURPOSE : Translates rotates etc... all defined coordinates
//
///////////////////////////////////////////////////////////////////////////////
void Camera::Update ()
{
float XTrans, YTrans, ZTrans;
float SCRotY;
XTrans = -Position.x;
YTrans = -Position.y;
ZTrans = -Position.z;
SCRotY = 360.0f - this->m_YRotate;
glRotatef (this->m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (this->m_YRotate, 0.0f, 1.0f, 0.0f);
glTranslatef (XTrans, YTrans, ZTrans);
}
Edited by - ZGL_Sigma on December 29, 2001 3:13:16 PM
the mistake was here
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION : Camera::Update
//
// PURPOSE : Translates rotates etc... all defined coordinates
//
///////////////////////////////////////////////////////////////////////////////
void Camera::Update ()
{
float XTrans, YTrans, ZTrans;
float SCRotY;
XTrans = -Position.x;
YTrans = -Position.y;
ZTrans = -Position.z;
SCRotY = 360.0f - this->m_YRotate;
glRotatef (this->m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (this->m_YRotate, 0.0f, 1.0f, 0.0f);
glTranslatef (XTrans, YTrans, ZTrans);
}
Edited by - ZGL_Sigma on December 29, 2001 3:13:16 PM
I hate signatures !!!
replace this in the function Update
glRotatef (this->m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (this->m_YRotate, 0.0f, 1.0f, 0.0f);
by
glRotatef (360.0f - this->m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (360.0f - this->m_YRotate, 0.0f, 1.0f, 0.0f);
or
glRotatef (360.0f - m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (360.0f - m_YRotate, 0.0f, 1.0f, 0.0f);
and it should work.
Why are you calling the this pointer all the time ?
It''s useless but every body has got it''s own coding style.
glRotatef (this->m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (this->m_YRotate, 0.0f, 1.0f, 0.0f);
by
glRotatef (360.0f - this->m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (360.0f - this->m_YRotate, 0.0f, 1.0f, 0.0f);
or
glRotatef (360.0f - m_XRotate, 1.0f, 0.0f, 0.0f);
glRotatef (360.0f - m_YRotate, 0.0f, 1.0f, 0.0f);
and it should work.
Why are you calling the this pointer all the time ?
It''s useless but every body has got it''s own coding style.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
In the last line off my previous reply replace it''s by his
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
Hello - thanks for your help man !!!
I like to call the this pointer because it gives me a list of all the variables - and so I don''t have to care about Case sensitivity.
does the this make a difference in speed ???
I like to call the this pointer because it gives me a list of all the variables - and so I don''t have to care about Case sensitivity.
does the this make a difference in speed ???
I hate signatures !!!
Hello - thanks for your help man !!!
I like to call the this pointer because it gives me a list of all the variables - and so I don''t have to care about Case sensitivity.
does the this make a difference in speed ???
I like to call the this pointer because it gives me a list of all the variables - and so I don''t have to care about Case sensitivity.
does the this make a difference in speed ???
I hate signatures !!!
You could also do this:
glRotatef (this->m_XRotate,-1.0f, 0.0f, 0.0f);
glRotatef (this->m_YRotate, 0.0f,-1.0f, 0.0f);
notice the -1.0f rather than 1.0f. It has the same effect as what George2 suggested, but saves you from one subtraction... code bumming at its best!
glRotatef (this->m_XRotate,-1.0f, 0.0f, 0.0f);
glRotatef (this->m_YRotate, 0.0f,-1.0f, 0.0f);
notice the -1.0f rather than 1.0f. It has the same effect as what George2 suggested, but saves you from one subtraction... code bumming at its best!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement