OpenGL - Moving Camera forward
Below is my code that lets me to move the camera forward it works fine but i always want to know if I'm writing code in a efficient way..

    void keyboard (unsigned char key, int x, int y) {
      
        if (key=='w')
        {
        float xrotrad, yrotrad;
        yrotrad = (yrot / 180 * 3.141592654f);
        xrotrad = (xrot / 180 * 3.141592654f); 
        xpos += float(sin(yrotrad))* 3 ;//move forward and initialise speed
        zpos -= float(cos(yrotrad))* 3 ;
        ypos -= float(sin(xrotrad))* 3 ;
        } 

OK this question just came to my head: Does anyone know any good OpenGL collision tutorials online.. if yes would be more than grateful if u share..

Thanks for reading my question
OpenGL - Moving Camera forward
===

Below is my code that lets me to move the camera forward it works fine but i always want to know if I'm writing code in a efficient way..

    void keyboard (unsigned char key, int x, int y) {
      
        if (key=='w')
        {
        float xrotrad, yrotrad;
        yrotrad = (yrot / 180 * 3.141592654f);
        xrotrad = (xrot / 180 * 3.141592654f); 
        xpos += float(sin(yrotrad))* 3 ;//move forward and initialise speed
        zpos -= float(cos(yrotrad))* 3 ;
        ypos -= float(sin(xrotrad))* 3 ;
        } 

OK this question just came to my head: Does anyone know any good OpenGL collision tutorials online.. if yes would be more than grateful if u share..

Thanks for reading my question