Method GetClosestAvailablePosition
GetClosestAvailablePosition(RideVector3, RideVector3, Int32)
Calculates a destination that can be reached. If target is unreachable the destination moves closer to the start
Declaration
public virtual RideVector3 GetClosestAvailablePosition(RideVector3 start, RideVector3 target, int numAttempts = 10)
Parameters
Type | Name | Description |
---|---|---|
RideVector3 | start | The starting point of the path |
RideVector3 | target | the desired destination point in world space of the path |
System.Int32 | numAttempts | The number of attempts to find a suitable destination before giving up |
Returns
Type | Description |
---|---|
RideVector3 | A destination that can be reached. If nothing was available, start is returned |
Implements
GetClosestAvailablePosition(RideVector3, Single)
Finds the closest position on the navigation mesh to the parameter given a distance radius to look for
Declaration
public abstract RideVector3 GetClosestAvailablePosition(RideVector3 position, float distance = 1F)
Parameters
Type | Name | Description |
---|---|---|
RideVector3 | position | The start position to find the nearest position on the navigation mesh |
System.Single | distance | The distance radius to search around |
Returns
Type | Description |
---|---|
RideVector3 | The position on the navigation mesh nearest to the start position; If it cannot find a position, it will return a RideVector3 with Negative Infinity values |