Changeset 10734 in orxonox.OLD for branches/presentation/src/world_entities/npcs
- Timestamp:
- Jun 20, 2007, 2:44:33 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/npcs/actionbox_enemy.cc
r10727 r10734 257 257 void ActionboxEnemy::moveTowardsBox( ActionBox * box, float dt ) 258 258 { 259 260 259 Vector targetPos = box->getAbsCoor() + box->getAbsDir().apply( Vector( 1, 0, 0 ) )*box->getDepth()*0.66f; 261 260 Vector targetDir = targetPos - myCoor; 261 262 Vector boxDir = box->getAbsDir().apply( Vector(1, 0, 0 ) ); 263 float boxDist = boxDir.dot( targetDir ); 264 265 if ( boxDist > 0 ) 266 { 267 Vector myRelCoor = this->getAbsCoor() - box->getAbsCoor(); 268 float newDist = boxDir.dot( myRelCoor ); 269 targetPos = box->getAbsCoor() + box->getAbsDir().apply( Vector( 1, 0, 0 ) )* newDist * 0.8; 270 targetDir = targetPos - myCoor; 271 } 262 272 263 273 moveTowards(targetPos, targetDir, dt);
Note: See TracChangeset
for help on using the changeset viewer.