SnapController class handles loading and updating of road and waypoint data for the map.
More...
|
void | Update () |
| Highlights the waypoint indicator nearest to the mouse position.
|
|
int | GetRoadIdAndLaneIdFromString (string laneIdString) |
|
Location | FindWaypoint (Vector2 mousePosition) |
| Finds the nearest waypoint to a given mouse position.
|
|
AStarWaypoint | FindLaneAndWaypoint (Vector2 mousePosition) |
|
Lane | GetNeighboringLanes (Lane l) |
|
bool | CheckLaneChange (Lane startLane, Lane endLane, AStarWaypoint startWaypoint, AStarWaypoint endWaypoint) |
| Checks if a lane change is possible between the start and end lanes and waypoints.
|
|
List< int > | FindPath (Vector2 start, Vector2 end, bool ignoreWaypoints) |
|
|
static double | FastEuclideanDistance (Vector2 a, Vector2 b) |
| Computes the fast Euclidean distance between two Vector2 points.
|
|
static float float y | UnityToCarla (float x, float y) |
|
static float | UnityRotToRadians (float rotation) |
| Converts a Unity rotation value to radians.
|
|
static int | CalculateTargetLaneValueCarla (Lane startLane, Lane endLane) |
| Calculates the target lane value for Carla, given start and end lanes. (NOT IMPLEMENTD)
|
|
|
GameObject | circlePrefab |
|
Dictionary< int, Road > | roads |
|
| int |
| Parses a lane ID string and returns the corresponding road ID and lane ID as a tuple.
|
|
| Lane |
| Finds the closest Lane and AStarWaypoint to the given mouse position.
|
|
| List< Vector2 > |
| Finds a path between the start and end positions, considering lane changes and optional waypoint ignoring.
|
|
|
static float | x |
| Converts Unity coordinates to Carla coordinates.
|
|
|
bool | IgnoreClicks [get, set] |
|
SnapController class handles loading and updating of road and waypoint data for the map.
◆ CalculateTargetLaneValueCarla()
static int SnapController.CalculateTargetLaneValueCarla |
( |
Lane |
startLane, |
|
|
Lane |
endLane |
|
) |
| |
|
inlinestatic |
Calculates the target lane value for Carla, given start and end lanes. (NOT IMPLEMENTD)
- Parameters
-
startLane | The starting Lane object. |
endLane | The ending Lane object. |
- Returns
- An integer representing the target lane value for Carla.
◆ CheckLaneChange()
Checks if a lane change is possible between the start and end lanes and waypoints.
- Parameters
-
- Returns
- True if a lane change is possible, false otherwise.</returns
◆ FastEuclideanDistance()
static double SnapController.FastEuclideanDistance |
( |
Vector2 |
a, |
|
|
Vector2 |
b |
|
) |
| |
|
inlinestatic |
Computes the fast Euclidean distance between two Vector2 points.
- Parameters
-
a | A Vector2 representing the first point. |
b | A Vector2 representing the second point. |
- Returns
- A double representing the fast Euclidean distance between the two points.
◆ FindWaypoint()
Location SnapController.FindWaypoint |
( |
Vector2 |
mousePosition | ) |
|
|
inline |
Finds the nearest waypoint to a given mouse position.
- Parameters
-
mousePosition | The Vector2 representing the mouse position. |
- Returns
- Returns a Location object of the nearest waypoint.
◆ UnityRotToRadians()
static float SnapController.UnityRotToRadians |
( |
float |
rotation | ) |
|
|
inlinestatic |
Converts a Unity rotation value to radians.
- Parameters
-
rotation | A float representing the rotation value in Unity. |
- Returns
- A float representing the rotation value in radians.
◆ int
Parses a lane ID string and returns the corresponding road ID and lane ID as a tuple.
- Parameters
-
laneIdString | The lane ID string to parse. |
- Returns
- Returns a tuple containing the road ID and lane ID.
◆ Lane
Finds the closest Lane and AStarWaypoint to the given mouse position.
Returns the neighboring lanes of a given Lane.
- Parameters
-
mousePosition | A Vector2 representing the position of the mouse cursor. |
- Returns
A tuple containing the closest Lane and AStarWaypoint to the given mouse position.</returns
- Parameters
-
- Returns
- A tuple containing the previous and next lanes of the given Lane.
◆ List< Vector2 >
SnapController.List< Vector2 > |
Finds a path between the start and end positions, considering lane changes and optional waypoint ignoring.
- Parameters
-
start | A Vector2 representing the starting position. |
end | A Vector2 representing the ending position. |
ignoreWaypoints | A boolean indicating whether to ignore waypoints and return a direct path. |
- Returns
- A tuple containing a list of Vector2 waypoints and a list of integer indices representing lane changes in the path.
Converts Unity coordinates to Carla coordinates.
- Parameters
-
x | A float representing the X coordinate in Unity. |
y | A float representing the Y coordinate in Unity. |
- Returns
- A tuple containing the X and Y coordinates in Carla.
The documentation for this class was generated from the following file:
- C:/Users/stefa/source/repos/AI_Testing_Simulator/Unity/Assets/Scripts/SnapController.cs