Changeset 9054
- Timestamp:
- Mar 23, 2012, 4:02:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/waypoints/src/orxonox/controllers/FormationController.cc
r9043 r9054 274 274 Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target); 275 275 float distance = (target - this->getControllableEntity()->getPosition()).length(); 276 if(coord.x < 0.0 1 && coord.y < 0.01)276 if(coord.x < 0.0001 && coord.y < 0.0001) 277 277 { 278 // I AM HERE 279 //this->getControllableEntity()->setOrientation() 278 // I AM HERE 279 Vector3 v_temp = this->getControllableEntity()->getPosition() * target; 280 Quaternion quat = v_temp.getRotationTo(target); 281 this->getControllableEntity()->rotate(quat); 282 283 //this->getControllableEntity()->setOrientation(this->getControllableEntity()->getPosition().getRotationTo(target) * this->getControllableEntity()->getOrientation()); 280 284 } 281 285 … … 285 289 { 286 290 // Multiply with ROTATEFACTOR_FREE to make them a bit slower 287 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x);288 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y);291 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * coord.x * 2); 292 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * coord.y * 2); 289 293 } 290 294 … … 301 305 if (this->target_ || distance > 10) 302 306 { 303 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);304 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);307 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * coord.x * 2); 308 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * coord.y * 2); 305 309 } 306 310 … … 316 320 { 317 321 318 this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);319 this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);322 this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * coord.x * 2); 323 this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * coord.y * 2); 320 324 321 325 if (distance < 300)
Note: See TracChangeset
for help on using the changeset viewer.