Changeset 8967 in orxonox.OLD
- Timestamp:
- Jun 30, 2006, 4:28:40 PM (18 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
r8966 r8967 196 196 this->setAnimation(RUN, MD2_ANIM_LOOP); 197 197 198 Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized(); 198 Vector dir = (currentAnimation.v - this->getAbsCoor()); 199 dir.y = 0.0f; 200 dir.getNormalized(); 199 201 this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0))); 200 202 … … 262 264 this->setAnimation(RUN, MD2_ANIM_LOOP); 263 265 264 Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized(); 266 Vector dir = (currentAnimation.v - this->getAbsCoor()); 267 dir.y = 0.0f; 268 dir.getNormalized(); 265 269 this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0); 266 270 … … 472 476 else 473 477 { 478 dest.y = 0.0f; 474 479 this->shiftCoor(dest.getNormalized() * currentAnimation.speed * dt); 475 480 … … 486 491 { 487 492 this->shiftCoor(dest.getNormalized() * currentAnimation.speed * dt); 488 this->setAbsDir(Quaternion(dest.getNormalized(), Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));489 493 } 490 494 } … … 499 503 { 500 504 this->shiftCoor(dest.getNormalized() * currentAnimation.speed * dt); 501 this->setAbsDir(Quaternion(dest.getNormalized(), Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));502 505 } 503 506 } … … 519 522 } 520 523 } 524 525 // physical falling of the player 526 if( !this->isOnGround()) 527 { 528 this->fallVelocity += 300.0f * dt; 529 velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity; 530 PRINTF(0)("%s is not on ground\n", this->getName()); 531 } 532 else 533 { 534 this->fallVelocity = 0.0f; 535 } 536 537 this->shiftCoor(Vector(0, -this->fallVelocity * dt,0)); 521 538 522 539 } -
branches/single_player_map/src/world_entities/npcs/generic_npc.h
r8966 r8967 129 129 Animation3D* currentAnim; 130 130 float time; //!< Duration of the action 131 float fallVelocity; 131 132 }; 132 133
Note: See TracChangeset
for help on using the changeset viewer.