# Move an texture object around a circle

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(){
gl.glLineWidth(3);
gl.glBegin(GL_LINE_STRIP);
gl.glColor3f(0,0,1);

``````for(double a= 0  ; a &lt;(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.

Hi !

I am not sure if I got it right, but it all sounds very 2D to me, and in that case canâ€™t you just use the coordinates you calculate in the loop as translation values for the ship ? you will of course still have the problem getting the ship facing the right direction, but if you use a vector from the center of the circle to the coordinate you can calculate the normal 90 degree from that.

Mikael