02-01-2004, 05:15 AM

Hi i am trying to make a texture follow the x and y coordinates of a circle, i.e. the object moves around all drawn points of the circle.

firstly my circle object.public void DrawCircle(){

double radius;

radius = 1.5;

gl.glLineWidth(3);

gl.glBegin(GL_LINE_STRIP);

gl.glColor3f(0,0,1);

for(double a= 0 ; a <(2 * Math.PI) ; a+=(Math.PI/180))

{

double x = Math.sin(a) * radius;

double y = Math.cos(a) * radius;

gl.glVertex2d(x,y);

}

gl.glEnd();

}

The texture has X and Y, such as

shipPosX = 8.0f //ship is out of screen

shipPosY = 0.0f

I need the ship to move into the screen from the right which i do by, decrementing the X coordinate by 0.02 until it reaches say 5.0 (which then the ship is visible) then it finds the circle and moves around it facing the same way until it is destroyed by the user.

I have a move ship method for now which just decrements the ship all the way to the left of the screen, then regenerates it from the right again. Is it possible to make the ship move around the circle and if so if any one has any views i would be very grateful.

i can translate and scale the object to the required position but where in which method do i make the ship acknowledge the circles points in order for it to follow them.

firstly my circle object.public void DrawCircle(){

double radius;

radius = 1.5;

gl.glLineWidth(3);

gl.glBegin(GL_LINE_STRIP);

gl.glColor3f(0,0,1);

for(double a= 0 ; a <(2 * Math.PI) ; a+=(Math.PI/180))

{

double x = Math.sin(a) * radius;

double y = Math.cos(a) * radius;

gl.glVertex2d(x,y);

}

gl.glEnd();

}

The texture has X and Y, such as

shipPosX = 8.0f //ship is out of screen

shipPosY = 0.0f

I need the ship to move into the screen from the right which i do by, decrementing the X coordinate by 0.02 until it reaches say 5.0 (which then the ship is visible) then it finds the circle and moves around it facing the same way until it is destroyed by the user.

I have a move ship method for now which just decrements the ship all the way to the left of the screen, then regenerates it from the right again. Is it possible to make the ship move around the circle and if so if any one has any views i would be very grateful.

i can translate and scale the object to the required position but where in which method do i make the ship acknowledge the circles points in order for it to follow them.