Changeset 8824 in orxonox.OLD for branches/single_player_map/src/world_entities/npcs
- Timestamp:
- Jun 27, 2006, 2:31:12 PM (19 years ago)
- Location:
- branches/single_player_map/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/world_entities/npcs/generic_npc.cc
r8823 r8824 401 401 float GenericNPC::lookAt(WorldEntity* worldEntity) 402 402 {} 403 404 405 /** 406 * turns to a given direction 407 */ 408 bool GenericNPC::turnTo(float qu, float qx, float qy, float qz) 409 { 410 Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu); 411 412 // check if this is the current goal 413 if( this->destDir != destDir) 414 { 415 this->destCoor = destCoor; 416 417 float time = 5.0f; 418 419 if( this->currentAnim != NULL) 420 delete this->currentAnim; 421 422 this->currentAnim = new Animation3D(this); 423 this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR); 424 this->currentAnim->addKeyFrame(this->getAbsCoor(), this->destDir, time, ANIM_LINEAR, ANIM_LINEAR); 425 426 this->currentAnim->setInfinity(ANIM_INF_CONSTANT); 427 this->currentAnim->play(); 428 429 this->setAnimation(CROUCH_STAND, MD2_ANIM_LOOP); 430 } 431 432 // calculate the distance 433 Vector distance = this->getAbsCoor() - this->destCoor; 434 return distance.len(); 435 } 436 403 437 404 438 -
branches/single_player_map/src/world_entities/npcs/generic_npc.h
r8823 r8824 63 63 /* some oriantation functions */ 64 64 float lookAt(WorldEntity* worldEntity); 65 bool turnTo(float qu, float qx, float qy, float qz); 65 66 66 67 /* talking funcitons*/
Note: See TracChangeset
for help on using the changeset viewer.