Changeset 3172 in orxonox.OLD for orxonox/branches/dave/src/player.cc
- Timestamp:
- Dec 14, 2004, 11:36:07 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/dave/src/player.cc
r3155 r3172 29 29 obj = new Object ("reaplow.obj"); 30 30 tottime=0.0f; 31 movfinishright=movfinishleft=movfinishup=movfinishdown=false; 32 angleturn=false; 31 33 32 34 /* … … 93 95 { 94 96 //printf("Player|recieved command [%s]\n", cmd->cmd); 97 95 98 tottime=cmd->tottime; 99 rottime=cmd->rottime; 100 angleturn=cmd->angleturn; 101 102 96 103 if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp; 97 104 else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp; … … 106 113 glLoadIdentity(); 107 114 float matrix[4][4]; 108 115 float a[3]; 116 a[0]=.8f; 117 a[1]=.8f; 118 a[2]=.8f; 119 glMaterialfv(GL_FRONT,GL_DIFFUSE,a); 109 120 glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z); 110 121 get_placement()->w.matrix (matrix); 111 122 glMultMatrixf ((float*)matrix); 112 123 113 124 glMatrixMode (GL_MODELVIEW); 125 glRotatef (angle,0,0,1); 114 126 glRotatef (-90, 0,1,0); 127 115 128 obj->draw(); 116 129 // glCallList (objectList); … … 141 154 Vector orthDirection(0.0, 0.0, 1.0); 142 155 orthDirection = orthDirection.cross(direction); 156 157 if(rottime<1.0f) 158 rottime=rottime+2.5f*time; 159 else 160 rottime=1.0f; 143 161 if(tottime<1.5f) 144 162 tottime=tottime+4.0f*time; 145 163 else 146 164 tottime=1.5f; 147 if( bUp) { accel = accel+(direction*acceleration*pow(tottime,2.0f)); } 148 if( bDown) { accel = accel-(direction*acceleration*pow(tottime,2.0f)); } 149 if( bLeft ) { accel = accel + (orthDirection*acceleration*pow(tottime,2.0f)); } 150 if( bRight ) { accel = accel - (orthDirection*acceleration*pow(tottime,2.0f));} 165 166 //Langsam zurückdrehen ->anlgeturn ist für das Zurückdrehen verantwortlich! 167 if((angleturn||bLeft&&bRight)&&angle<=0.0f){ 168 if(!bLeft) 169 angle=angle+rottime*10.0f; 170 if(angle>0.0f){ 171 172 angleturn=false; 173 angle=0.0f;} 174 } 175 176 if((angleturn||bLeft&&bRight)&&angle>=0.0f){ 177 if(!bRight) 178 angle=angle-rottime*10.0f; 179 if(angle<0.0f){ 180 angleturn=false; 181 angle=0.0f;} 182 } 183 //Bewegung lansam abbremsen ************** 184 if(movfinishleft&&!bLeft){ 185 accel=accel+(orthDirection*acceleration*(tottimecopy-pow(tottime,1.5f)+.5f)); 186 if(tottime>tottimecopy) 187 movfinishleft=false; 188 } 189 if(movfinishright&&!bRight){ 190 accel=accel-(orthDirection*acceleration*(tottimecopy-pow(tottime,1.5f)+.5f)); 191 if(tottime>tottimecopy) 192 movfinishright=false; 193 } 194 if(movfinishup&&!bUp){ 195 accel=accel+(direction*acceleration*(tottimecopy-pow(tottime,1.5f)+.5f)); 196 if(tottime>tottimecopy) 197 movfinishup=false; 198 } 199 200 if(movfinishdown&&!bDown){ 201 accel=accel-(direction*acceleration*(tottimecopy-pow(tottime,1.5f)+.5f)); 202 if(tottime>tottimecopy) 203 movfinishdown=false; 204 } 205 // ************** 206 207 if( bUp) { accel = accel+(direction*acceleration*pow(tottime,2.0f));movfinishup=true;tottimecopy=tottime;} 208 if( bDown) { accel = accel-(direction*acceleration*pow(tottime,2.0f));movfinishdown=true;tottimecopy=tottime; } 209 if( bLeft ) { accel = accel + (orthDirection*acceleration*pow(tottime,2.0f)); 210 if(angle>-40.0f){ 211 angle=angle-rottime*40.0f;} 212 movfinishleft=true; 213 tottimecopy=tottime;} 214 if( bRight ) { accel = accel - (orthDirection*acceleration*pow(tottime,2.0f)); 215 if(angle<40.0f){ 216 angle=angle+rottime*40.0f;} 217 movfinishright=true; 218 tottimecopy=tottime; 219 } 151 220 if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */} 152 221 if( bDescend) {/* FIXME */}
Note: See TracChangeset
for help on using the changeset viewer.