[Orxonox-commit 4666] r9337 - in code/branches/presentation2012merge/src: modules/docking orxonox/controllers
landauf at orxonox.net
landauf at orxonox.net
Sun Jul 29 23:02:14 CEST 2012
Author: landauf
Date: 2012-07-29 23:02:13 +0200 (Sun, 29 Jul 2012)
New Revision: 9337
Modified:
code/branches/presentation2012merge/src/modules/docking/DockingController.cc
code/branches/presentation2012merge/src/orxonox/controllers/FormationController.cc
Log:
fixed "quivering" movement also for DockingController and in the 2nd move-to-position function of FormationController
Modified: code/branches/presentation2012merge/src/modules/docking/DockingController.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/docking/DockingController.cc 2012-07-29 20:44:11 UTC (rev 9336)
+++ code/branches/presentation2012merge/src/modules/docking/DockingController.cc 2012-07-29 21:02:13 UTC (rev 9337)
@@ -59,7 +59,7 @@
return;
float distance = (this->dock_->getWorldPosition() - entity->getPosition()).length();
- Vector2 coord = get2DViewdirection( // I don't understand this too
+ Vector2 coord = get2DViewcoordinates( // I don't understand this too
entity->getPosition(),
entity->getOrientation() * WorldEntity::FRONT,
entity->getOrientation() * WorldEntity::UP,
@@ -69,8 +69,8 @@
// adjust direction of spaceship
if (distance > 10)
{
- entity->rotateYaw(-1.0f * 0.8f * sgn(coord.x) * coord.x*coord.x);
- entity->rotatePitch(0.8f * sgn(coord.y) * coord.y*coord.y);
+ entity->rotateYaw(-1.0f * 0.8f * clamp(coord.x * 10, -1.0f, 1.0f));
+ entity->rotatePitch(0.8f * clamp(coord.y * 10, -1.0f, 1.0f));
}
/*// adjust speed
Modified: code/branches/presentation2012merge/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/branches/presentation2012merge/src/orxonox/controllers/FormationController.cc 2012-07-29 20:44:11 UTC (rev 9336)
+++ code/branches/presentation2012merge/src/orxonox/controllers/FormationController.cc 2012-07-29 21:02:13 UTC (rev 9337)
@@ -1050,14 +1050,14 @@
if (!this->getControllableEntity())
return;
- Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
+ Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
float distance = (target - this->getControllableEntity()->getPosition()).length();
if (this->target_ || distance > minDistance)
{
// Multiply with ROTATEFACTOR_FREE to make them a bit slower
- this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);
- this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);
+ this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * clamp(coord.x * 10, -1.0f, 1.0f));
+ this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * clamp(coord.y * 10, -1.0f, 1.0f));
this->getControllableEntity()->moveFrontBack(SPEED_FREE);
}
More information about the Orxonox-commit
mailing list