Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
6.01.00228 More wide turn fixes #3587
Browse files Browse the repository at this point in the history
Turned out the previous 'proper' fix wasn't quite proper...
pvaiko committed Jun 1, 2019
1 parent d6b39f9 commit 9451207
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="40">
<version>6.01.00227</version>
<version>6.01.00228</version>
<author><![CDATA[Courseplay.devTeam]]></author>
<title>
<br>CoursePlay SIX</br>
28 changes: 14 additions & 14 deletions turn.lua
Original file line number Diff line number Diff line change
@@ -932,18 +932,18 @@ function courseplay:generateTurnTypeWideTurnWithAvoidance(vehicle, turnInfo)
courseplay:generateTurnCircle(vehicle, center, startDir, stopDir, turnInfo.turnRadius, turnInfo.direction);

--- Generate line between first and second turn circles
fromPoint.x, _, fromPoint.z = localToWorld(turnInfo.directionNode, turnInfo.turnRadius * turnInfo.direction, 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnRadius);
toPoint.x, _, toPoint.z = localToWorld(turnInfo.directionNode, (turnInfo.targetDeltaX - turnInfo.turnRadius - turnInfo.turnDiameter) * turnInfo.direction, 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnRadius);
fromPoint.x, fromPoint.z = stopDir.x, stopDir.z
toPoint.x, _, toPoint.z = localToWorld(turnInfo.directionNode, turnInfo.targetDeltaX - turnInfo.direction * (turnInfo.turnRadius + turnInfo.turnDiameter), 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnRadius);
courseplay:generateTurnStraightPoints(vehicle, fromPoint, toPoint);

--- Generate the second turn circles
center.x,_,center.z = localToWorld(turnInfo.directionNode, (turnInfo.targetDeltaX - turnInfo.turnRadius - turnInfo.turnDiameter) * turnInfo.direction, 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnDiameter);
startDir.x,_,startDir.z = localToWorld(turnInfo.directionNode, (turnInfo.targetDeltaX - turnInfo.turnRadius - turnInfo.turnDiameter) * turnInfo.direction, 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnRadius);
stopDir.x,_,stopDir.z = localToWorld(turnInfo.directionNode, (turnInfo.targetDeltaX - turnInfo.turnDiameter) * turnInfo.direction, 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnDiameter);
center.x,_,center.z = localToWorld(turnInfo.directionNode, turnInfo.targetDeltaX - turnInfo.direction * (turnInfo.turnRadius + turnInfo.turnDiameter), 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnDiameter);
startDir.x, startDir.z = toPoint.x, toPoint.z;
stopDir.x,_,stopDir.z = localToWorld(turnInfo.directionNode, turnInfo.targetDeltaX - turnInfo.direction * turnInfo.turnDiameter, 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnDiameter);
courseplay:generateTurnCircle(vehicle, center, startDir, stopDir, turnInfo.turnRadius, turnInfo.direction * -1);

--- Generate line between second and third turn circles
fromPoint.x, _, fromPoint.z = localToWorld(turnInfo.directionNode, (turnInfo.targetDeltaX - turnInfo.turnDiameter) * turnInfo.direction, 0, turnInfo.zOffset - turnInfo.reverseOffset + turnInfo.turnDiameter);
fromPoint.x, fromPoint.z = stopDir.x, stopDir.z;
toPoint.x, _, toPoint.z = localToWorld(turnInfo.targetNode, turnInfo.turnDiameter * turnInfo.direction, 0, turnInfo.reverseOffset);
courseplay:generateTurnStraightPoints(vehicle, fromPoint, toPoint);

@@ -954,7 +954,7 @@ function courseplay:generateTurnTypeWideTurnWithAvoidance(vehicle, turnInfo)
courseplay:generateTurnCircle(vehicle, center, startDir, stopDir, turnInfo.turnRadius, turnInfo.direction, true);

----------------------------------------------------------
-- If new lane is behind of us, Do the 180-90-90 turn
-- If new lane is behind us, Do the 180-90-90 turn
----------------------------------------------------------
else
--- Generate the first turn circles
@@ -964,24 +964,24 @@ function courseplay:generateTurnTypeWideTurnWithAvoidance(vehicle, turnInfo)
courseplay:generateTurnCircle(vehicle, center, startDir, stopDir, turnInfo.turnRadius, turnInfo.direction);

--- Generate line between first and second turn circles
fromPoint.x, _, fromPoint.z = localToWorld(turnInfo.directionNode, turnInfo.turnDiameter * turnInfo.direction, 0, turnInfo.zOffset - turnInfo.reverseOffset);
toPoint.x, _, toPoint.z = localToWorld(turnInfo.targetNode, (turnInfo.targetDeltaX - turnInfo.turnDiameter) * turnInfo.direction, 0, turnInfo.reverseOffset - turnInfo.turnDiameter);
fromPoint.x, fromPoint.z = stopDir.x, stopDir.z
toPoint.x, _, toPoint.z = localToWorld(turnInfo.targetNode, turnInfo.targetDeltaX - turnInfo.direction * turnInfo.turnDiameter, 0, turnInfo.reverseOffset - turnInfo.turnDiameter);
courseplay:generateTurnStraightPoints(vehicle, fromPoint, toPoint);

--- Generate the second turn circles
center.x,_,center.z = localToWorld(turnInfo.targetNode, (turnInfo.targetDeltaX - turnInfo.turnDiameter - turnInfo.turnRadius) * turnInfo.direction, 0, turnInfo.reverseOffset - turnInfo.turnDiameter);
startDir.x,_,startDir.z = localToWorld(turnInfo.targetNode, (turnInfo.targetDeltaX - turnInfo.turnDiameter) * turnInfo.direction, 0, turnInfo.reverseOffset - turnInfo.turnDiameter);
stopDir.x,_,stopDir.z = localToWorld(turnInfo.targetNode, (turnInfo.targetDeltaX- turnInfo.turnDiameter - turnInfo.turnRadius) * turnInfo.direction, 0, turnInfo.reverseOffset - turnInfo.turnRadius);
center.x,_,center.z = localToWorld(turnInfo.targetNode, turnInfo.targetDeltaX - turnInfo.direction * (turnInfo.turnRadius + turnInfo.turnDiameter), 0, turnInfo.reverseOffset - turnInfo.turnDiameter);
startDir.x, startDir.z = toPoint.x, toPoint.z;
stopDir.x,_,stopDir.z = localToWorld(turnInfo.targetNode, turnInfo.targetDeltaX - turnInfo.direction * (turnInfo.turnRadius + turnInfo.turnDiameter), 0, turnInfo.reverseOffset - turnInfo.turnRadius);
courseplay:generateTurnCircle(vehicle, center, startDir, stopDir, turnInfo.turnRadius, turnInfo.direction * -1);

--- Generate line between second and third turn circles
fromPoint.x, _, fromPoint.z = localToWorld(turnInfo.targetNode, (turnInfo.targetDeltaX - turnInfo.turnDiameter - turnInfo.turnRadius) * turnInfo.direction, 0, turnInfo.reverseOffset - turnInfo.turnRadius);
fromPoint.x, fromPoint.z = stopDir.x, stopDir.z
toPoint.x, _, toPoint.z = localToWorld(turnInfo.targetNode, turnInfo.turnRadius * turnInfo.direction, 0, turnInfo.reverseOffset - turnInfo.turnRadius);
courseplay:generateTurnStraightPoints(vehicle, fromPoint, toPoint);

--- Generate the third turn circles
center.x,_,center.z = localToWorld(turnInfo.targetNode, turnInfo.turnRadius * turnInfo.direction, 0, turnInfo.reverseOffset);
startDir.x,_,startDir.z = localToWorld(turnInfo.targetNode, turnInfo.turnRadius * turnInfo.direction, 0, turnInfo.reverseOffset - turnInfo.turnRadius);
startDir.x, startDir.z = toPoint.x, toPoint.z;
stopDir.x,_,stopDir.z = localToWorld(turnInfo.targetNode, 0, 0, turnInfo.reverseOffset);
courseplay:generateTurnCircle(vehicle, center, startDir, stopDir, turnInfo.turnRadius, turnInfo.direction, true);
end;

1 comment on commit 9451207

@pvaiko
Copy link
Contributor Author

@pvaiko pvaiko commented on 9451207 Jun 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #3857

Please sign in to comment.