Skip to content

Commit

Permalink
Merge pull request #1141 from CitiesSkylinesMods/bugfix/1138-half-seg…
Browse files Browse the repository at this point in the history
…ment-detection

Improved half-segment detection
  • Loading branch information
krzychu124 committed Aug 6, 2021
2 parents 5c38a65 + 88a1b77 commit 3d8c533
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions TLM/TLM/UI/TrafficManagerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public class TrafficManagerTool
internal const float MAX_HIT_ERROR = 2.5f;

/// <summary>Maximum detection radius of segment raycast hit position.</summary>
internal const float NODE_DETECTION_RADIUS = 15f;
internal const float NODE_DETECTION_RADIUS = 75f;
internal const float PRECISE_NODE_DETECTION_RADIUS = 15f;

internal static ushort HoveredNodeId;

Expand Down Expand Up @@ -1214,9 +1215,10 @@ private bool DetermineHoveredElements(bool raycastSegment = true) {
.m_position).magnitude;
float endDist = (segmentOutput.m_hitPos - nodesBuffer[endNodeId]
.m_position).magnitude;
if (startDist < endDist && startDist < NODE_DETECTION_RADIUS) {
float detectionRadius = raycastSegment ? NODE_DETECTION_RADIUS : PRECISE_NODE_DETECTION_RADIUS;
if (startDist < endDist && startDist < detectionRadius) {
HoveredNodeId = startNodeId;
} else if (endDist < startDist && endDist < NODE_DETECTION_RADIUS) {
} else if (endDist < startDist && endDist < detectionRadius) {
HoveredNodeId = endNodeId;
}
}
Expand Down

0 comments on commit 3d8c533

Please sign in to comment.