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