Changeset 10662 in orxonox.OLD for branches/vs-enhencements/src/world_entities/npcs
- Timestamp:
- May 24, 2007, 3:54:26 PM (18 years ago)
- Location:
- branches/vs-enhencements/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.cc
r10657 r10662 40 40 this->pitch = 0.0f; 41 41 this->dPitch = 0.0; 42 43 this->maxSpeed = 10; 44 this->acceleration = 3; 45 this->speed = 0; 42 46 43 47 if ( root ) … … 96 100 void ActionboxEnemy::moveTowardsBox( ActionBox * box, float dt ) 97 101 { 98 Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor(); 102 //Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor(); 103 static float time = 0; 104 time += dt; 105 Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor() + State::getPlayer()->getPlayable()->getAbsDir().apply(Vector(1, 0, 0))*50*(1.5 + sin(time/5)); 99 106 Vector targetDir = targetPos - myCoor; 100 107 … … 127 134 cur = tmp2; 128 135 129 myDir = cur; 136 myDir = cur; 137 138 Vector fw = cur.apply( Vector(1, 0, 0) ); 139 140 this->speed += this->acceleration*dt; 141 if ( this->speed > this->maxSpeed ) 142 this->speed = this->maxSpeed; 143 this->myCoor += fw*speed*dt; 130 144 } 131 145 -
branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.h
r10656 r10662 26 26 Quaternion qPitch; 27 27 28 float acceleration; 29 float maxSpeed; 30 float speed; 31 28 32 Quaternion myDir; 29 33 Vector myCoor;
Note: See TracChangeset
for help on using the changeset viewer.