GetRouteDistance
Appearance
| Environment: | Mission Scripting | |
|---|---|---|
| Function: | GetRouteDistance | |
| Function Description: | Calculates a series of points along a road path at a specified distance, starting from the first point and progressing sequentially until the target distance is reached. It adds each point to a table, stopping when the cumulative distance exceeds the specified value or reaches the end of the path. | |
| File Location: | cmm.spawnFunctions.lua | |
| Syntax: | CMM.GetRouteDistance( table PathOnRoadsTbl ) | |
| Return Value: | number | |
| Parameters: | Name | Description |
| PathOnRoadsTbl | Array of vec2 road points, each containing x and y coordinates, representing a path to traverse. | |
| Example: | CMM.GetRouteDistance({{x=100,y=200},{x=300,y=400},{x=500,y=600}}) | |
| Example Description: | Measures the total distance along the path defined by the points (100,200), (300,400), and (500,600) by calculating the 2D distance between each consecutive point and summing them up, returning the total distance as a number. | |
| Related Functions: | ||
| Notes: | ||