# how can I circle the scene using camera

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

## Recommended Posts

How can I circle scene using camera - circle around central point scene ?

I have many objects on scene:
 glPushMatrix(); glTranslatef(10, 30, -135); glRotatef(90, 0, 0, 1); glScaled(0.2, 1, 0.2); glutSolidCube(30); glPopMatrix(); glPushMatrix(); glTranslatef(40, 10, -100); glRotatef(90, 0, 0, 1); glScaled(0.2, 1, 0.2); glutSolidCube(30); glPopMatrix(); ........ 

And I have that code but this cause that scene circle camera :/ Screen what I want: http://img861.images....us/i/camk.jpg/
 //rotateValueX is a value which I am changing using keyboyard to rotate scene float ray = 20; float xCircle = ray * cos(PI * rotateValueX / 180); float zCircle = ray * sin(PI * rotateValueX / 180); gluLookAt(xCircle, 0, zCircle, 0, 0, 0, 0, 1, 0); 

##### Share on other sites

And one other thing change ray to float ray = 20.0f;
and divide pi by 180.0 or 180.0f not with 180

you must use floating points not integers

if you want to render rotated object etc from diffrent position

ie

gluLookAt(); // same glullookat values

static scene in example

glPushMatrix(); // <- dynamic scene in example
gluLookAt();// same glullookat values

glTranslatef(pos.x+TstaticX,pos.y+TstaticY,pos.z+TstaticZ);

glRotatef(glop+staticGLOP,0,1,0);
draw sth

glPopMatrix();

//-----------------

float xCircle = ray * cos(rotateValueX*(PI / 180));

float zCircle = ray * sin(rotateValueX *(PI/ 180));

GetTickCount() is WINAPI function

int ROTATION_START;

int ROTATION_TIME;

//at gldraw

at the beggining ROTATION_START = GetTickCount();

ROTATION_TIME = GetTickCount()-ROTATION_START;

ROTATION_SRART = GetTickCount();

otateValueX = otateValueX + 4.0* float(ROTATION_SRART/1000.0f); 4 degrees in one second

thx

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634091
• Total Posts
3015435
×