This example utilizes the A* Pathfinding Project Pro package which can be obtained from the Unity Asset Store. This solution is optional for RIDE users currently.
Demonstrates the dynamic navigation of different unit types to an arbitrary waypoint under a severe weather event affecting ground conditions.
Allow the terrain to stream completely, then choose to either left-click anywhere on the map to instantiate a single unit of a given type. Toggle units using the button in the upper-right corner. Alternatively, right-click to instantiate one unity of each type: Dismounted, Wheeled and Tracked.
Next, right-click anywhere on the map to designate a waypoint. Units will begin to navigate to said waypoint.
During this time, press the F key to start a rain even that will transform any areas classified as dirt or non-paved to mud that will in turn shift the pathfinding route of that unit to they waypoint.
Also, middle-click at any point along the intended route to detonate an IED that will then alter the route taken by the unit at that location.
Press the F key again to end the rain event and “dry out” the terrain.
At any time, press the R key to reset all input and units to the starting defaults.
Utilize the ground classification, weather event, camera movement, destruction, terrain streaming, and unit navigation by adding the ExampleGroundClassificationWeather script to the scene.
Add this script to an empty object in your scene, and then modify the parameters as needed to suit the needs of your scene. Ensure the relevant scene objects are included in each field.
Refer to the Rain Particle System child object of the camera in the example scene for the rain effect settings; copy over or remake this object in your custom scene.
Instance the appropriate unit prefabs: ChrUsaArmyInfantryAcu01PrefabDataMono, VehicleHumV, and Abrams.
Next, disable each prefab on startup. They will be added to ResourceLoader for user instantiation at run-time.
Add a TerrainDestructor prefab to enable trigger of an IED type of destruction at run-time. Set Mouse Destruction Button as 2 for middle-click.
Refer to the Canvas object in the example scene for toggling unit types; copy over or remake this object in your custom scene.
Instance the RideSystems prefab in your scene, then expand it in the Hierarchy view. ResourceLoader prefab, under Scene Game Objects, add ChrUsaArmyInfantryAcu01PrefabDataMono, VehicleHumV, and Abrams prefabs from the scene.
Ensure UnityAStarMovementSystem prefab is enabled; disable UnityNavMeshMovementSystem. Important, the scene requires A* Pathfinding Pro package as noted previously to function properly.