AddVehicleWithPath
Description
Instantiates a vehicle at the nearest waypoint to the provided position and sets the vehicle's path to the closest waypoint to the provided destination.
The instantiation occurs only when a vehicle of the specified type is available (disabled and ready for instantiation). The method will wait until a vehicle becomes available.
It is the developer's responsibility to choose a position out of view, as no additional verification will be made, and the vehicle might appear in front of the player.
Declaration
Parameters
Name | Description |
---|---|
position | A Vector3 for the initial position. The vehicle will be placed on the closest waypoint from this position. |
vehicleType | The type of the vehicle to be instantiated. |
destination | A Vector3 for the destination position. The closest waypoint from this position will be the destination of the vehicle. |
completeMethod | Callback triggered after instantiation. It returns the VehicleComponent and the waypoint index where the vehicle was instantiated. |
Example
Last updated