summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormasterm <devnull@localhost>2007-02-21 08:30:02 +0100
committermasterm <devnull@localhost>2007-02-21 08:30:02 +0100
commitdb238a3b606dba599d3900f7caebaa08c0b911c5 (patch)
tree2c6485329a42c465b2a9a1758309660479ceeea5 /source
parent22433e52a7b0f2e5c548edb915ea11a38a8077ad (diff)
downloadrc2007-soccer-db238a3b606dba599d3900f7caebaa08c0b911c5.tar
rc2007-soccer-db238a3b606dba599d3900f7caebaa08c0b911c5.zip
+++ CRIT! corrected position tracker formula
Diffstat (limited to 'source')
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.c b/source/Concept/Framework/modules/interpreter/position_tracker.c
index c8cd52d..57a6ba7 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.c
@@ -41,12 +41,15 @@ void Position_Tracker::Update()
float robotMovementY = movementDifferenceY / 2.0f;
robotMovementX += movementLeftX;
robotMovementY += movementLeftY + mouseLeft->GetPositionY();
- float robotDistance = sqrt(robotMovementX * robotMovementX + robotMovementY * robotMovementY);
+ //float robotDistance = sqrt(robotMovementX * robotMovementX + robotMovementY * robotMovementY);
float orientationDiff = atan2(movementDifferenceY, movementDifferenceX) - (PI / 2.0f);
- float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementX);
- float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementY);
+ float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotMovementX - sin(this->orientation + (orientationDiff / 2.0f)) * robotMovementY;
+ float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f) + PI / 2.0f) * robotMovementY + cos(this->orientation + (orientationDiff / 2.0f) - PI / 2.0f) * robotMovementX;
+
+ //float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementX);
+ //float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementY);
if(!robotMovementX && !robotMovementY)
{