diff options
author | masterm <devnull@localhost> | 2007-02-21 15:28:03 +0100 |
---|---|---|
committer | masterm <devnull@localhost> | 2007-02-21 15:28:03 +0100 |
commit | 9525458918383afbf324854fc2130d3740154da3 (patch) | |
tree | 3fe11d8287abcb68970c92af246b246d88b28d94 /source/Concept/Framework/modules | |
parent | db238a3b606dba599d3900f7caebaa08c0b911c5 (diff) | |
download | rc2007-soccer-9525458918383afbf324854fc2130d3740154da3.tar rc2007-soccer-9525458918383afbf324854fc2130d3740154da3.zip |
+++ another fix to position tracker
Diffstat (limited to 'source/Concept/Framework/modules')
-rwxr-xr-x | source/Concept/Framework/modules/interpreter/position_tracker.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.c b/source/Concept/Framework/modules/interpreter/position_tracker.c index 57a6ba7..63a7f5f 100755 --- a/source/Concept/Framework/modules/interpreter/position_tracker.c +++ b/source/Concept/Framework/modules/interpreter/position_tracker.c @@ -34,17 +34,17 @@ void Position_Tracker::Update() movementRightY = 0;
}
- float movementDifferenceX = movementRightX - movementLeftX;
+ float movementDifferenceX = (movementRightX + mouseRight->GetPositionX()) - (movementLeftX + mouseLeft->GetPositionX());
float movementDifferenceY = (movementRightY + mouseRight->GetPositionY()) - (movementLeftY + mouseLeft->GetPositionY());
+ float orientationDiff = atan2(movementDifferenceY, movementDifferenceX) - (PI / 2.0f);
+
float robotMovementX = movementDifferenceX / 2.0f;
float robotMovementY = movementDifferenceY / 2.0f;
- robotMovementX += movementLeftX;
- robotMovementY += movementLeftY + mouseLeft->GetPositionY();
+ robotMovementX += movementLeftX + mouseLeft->GetPositionX() + (-mouseLeft->GetPositionX() * cos(orientationDiff));
+ robotMovementY += movementLeftY + mouseLeft->GetPositionY() + (-mouseLeft->GetPositionX() * sin(orientationDiff));
//float robotDistance = sqrt(robotMovementX * robotMovementX + robotMovementY * robotMovementY);
- float orientationDiff = atan2(movementDifferenceY, movementDifferenceX) - (PI / 2.0f);
-
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;
|