Changeset 10271 in orxonox.OLD for branches/playability/src/world_entities/projectiles/spike_ball.cc
- Timestamp:
- Jan 17, 2007, 6:15:21 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/spike_ball.cc
r10261 r10271 179 179 { 180 180 Spike* pj = NULL; 181 /* printf( "KA-" );*/ 181 182 updateFireDir(); 183 182 184 for ( int i = 0; i < this->getFragments(); i++) 183 185 { 184 186 pj = new Spike(); 185 187 assert( pj ); 186 /* printf(" %i", i);*/187 188 pj->setParent(PNode::getNullParent()); 188 189 189 pj->setVelocity(this->launcher[i].getNormalized() * 250.0);190 dynamic_cast<Spike*>(pj)->setVelocity(this->launcher[i].getNormalized() * 250.0); 190 191 191 192 pj->setParent(PNode::getNullParent()); 192 193 pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size); 193 Quaternion q; 194 pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1))); 194 // Quaternion q; 195 // pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1))); 196 pj->setRelDir(Quaternion(0, this->launcher[i])); 195 197 196 198 pj->toList(this->getOMListNumber()); 197 199 198 /*199 pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));200 pj->setAbsDir(this->getAbsDir());*/201 200 pj->activate(); 202 201 } 203 /* printf( "BOOM\n" );*/204 202 } 205 203 … … 219 217 ca = cos (this->getAngle()); 220 218 sa = sin (this->getAngle()); 221 // final version below... easier to to cheat with the one above.222 219 223 220 m[0][0] = nx * nx * (1 - ca) + ca; … … 233 230 float x, y, z; 234 231 for (int i = 0; i < this->getFragments(); i++){ 235 // printf("%i ", i);236 232 x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z; 237 233 y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z; … … 240 236 this->launcher[i] = Vector (x, y, z); 241 237 } 242 // printf("\n");243 238 244 239 for( int i = 0; i < 3 ; i++) … … 254 249 void SpikeBall::tick (float dt) 255 250 { 256 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 257 Vector v = this->getVelocity() * dt; 251 Vector v = this->velocity * dt; 258 252 this->shiftCoor(v); 259 253 260 // if(this->lifeCycle > .9){261 // /* printf("time to blow: ");*/262 // // this->weaponMan->fire();263 // /* this->blow();*/264 // }265 254 266 255 if (this->tickLifeCycle(dt)){ … … 270 259 271 260 this->updateAngle( dt ); 272 // angle += rotationSpeed * dt;273 261 } 274 262 … … 289 277 { 290 278 glPushAttrib(GL_ENABLE_BIT); 291 //glDisable(GL_LIGHTING);292 293 279 glMatrixMode(GL_MODELVIEW); 294 280 glPushMatrix(); … … 296 282 float matrix[4][4]; 297 283 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 284 285 this->halo->draw(); 298 286 299 287 glRotatef(angle, this->getRotationAxis().x, this->getRotationAxis().y, this->getRotationAxis().z); … … 302 290 this->getModel()->draw(); 303 291 304 this->halo->draw();305 306 292 glPopMatrix(); 307 308 293 glPopAttrib(); 309 294 }
Note: See TracChangeset
for help on using the changeset viewer.