void Start() { Debug.Log("Please read the comments at the top before using the runtime API!"); // Create Road Network object roadNetwork = new ERRoadNetwork(); // Create road // ERRoad road = roadNetwork.CreateRoad(string name); // ERRoad road = roadNetwork.CreateRoad(string name, Vector3[] markers); // ERRoad road = roadNetwork.CreateRoad(string name, ERRoadType roadType); // ERRoad road = roadNetwork.CreateRoad(string name, ERRoadType roadType, Vector3[] markers); ERRoadType roadType = new ERRoadType(); roadType.roadWidth = 6; roadType.roadMaterial = Resources.Load("Materials/roads/single lane") as Material; Vector3[] markers = new Vector3[4]; markers[0] = new Vector3(200, 5, 200); markers[1] = new Vector3(250, 5, 200); markers[2] = new Vector3(250, 5, 250); markers[3] = new Vector3(300, 5, 250); road = roadNetwork.CreateRoad("road 1", roadType, markers); // Add Marker: ERRoad.AddMarker(Vector3); road.AddMarker(new Vector3(300, 5, 300)); // Add Marker: ERRoad.InsertMarker(Vector3); road.InsertMarker(new Vector3(275, 5, 235)); // Delete Marker: ERRoad.DeleteMarker(int index); road.DeleteMarker(2); // Set the road width : ERRoad.SetWidth(float); // road.SetWidth(10); // Set the road material : ERRoad.SetMaterial(Material); // Material mat = Resources.Load("Materials/roads/single lane") as Material; // road.SetMaterial(mat); // Build Road Network roadNetwork.BuildRoadNetwork(); // Restore Road Network // roadNetwork.RestoreRoadNetwork(); // create dummy object go = GameObject.CreatePrimitive(PrimitiveType.Cube); }
void Start() { Debug_Log.Call_WriteLog("Please read the comments at the top of the runtime script (/Assets/EasyRoads3D/Scripts/runtimeScript) before using the runtime API!"); // Create Road Network object roadNetwork = new ERRoadNetwork(); // Create road // ERRoad road = roadNetwork.CreateRoad(string name); // ERRoad road = roadNetwork.CreateRoad(string name, Vector3[] markers); // ERRoad road = roadNetwork.CreateRoad(string name, ERRoadType roadType); // ERRoad road = roadNetwork.CreateRoad(string name, ERRoadType roadType, Vector3[] markers); // get exisiting road types // ERRoadType[] roadTypes = roadNetwork.GetRoadTypes(); // ERRoadType roadType = roadNetwork.GetRoadTypeByName(string name); // create a new road type ERRoadType roadType = new ERRoadType(); roadType.roadWidth = 6; roadType.roadMaterial = Resources.Load("Materials/roads/road material") as Material; // optional roadType.layer = 1; roadType.tag = "Untagged"; // roadType.hasMeshCollider = false; // default is true // roadType = roadNetwork.GetRoadTypeByName("Train Rail"); // Debug_Log.Call_WriteLog(roadType.roadMaterial); // create a new road Vector3[] markers = new Vector3[4]; markers[0] = new Vector3(200, 5, 200); markers[1] = new Vector3(250, 5, 200); markers[2] = new Vector3(250, 5, 250); markers[3] = new Vector3(300, 5, 250); road = roadNetwork.CreateRoad("road 1", roadType, markers); // road.SetResolution(float value):void; // Add Marker: ERRoad.AddMarker(Vector3); road.AddMarker(new Vector3(300, 5, 300)); // Add Marker: ERRoad.InsertMarker(Vector3); road.InsertMarker(new Vector3(275, 5, 235)); // road.InsertMarkerAt(Vector3 pos, int index): void; // Delete Marker: ERRoad.DeleteMarker(int index); road.DeleteMarker(2); // Set the road width : ERRoad.SetWidth(float width); // road.SetWidth(10); // Set the road material : ERRoad.SetMaterial(Material path); // Material mat = Resources.Load("Materials/roads/single lane") as Material; // road.SetMaterial(mat); // add / remove a meshCollider component // road.SetMeshCollider(bool value):void; // set the position of a marker // road.SetMarkerPosition(int index, Vector3 position):void; // road.SetMarkerPositions(Vector3[] position):void; // road.SetMarkerPositions(Vector3[] position, int index):void; // get the position of a marker // road.GetMarkerPosition(int index):Vector3; // get the position of a marker // road.GetMarkerPositions():Vector3[]; // Set the layer // road.SetLayer(int value):void; // Set the tag // road.SetTag(string value):void; // set marker control type // road.SetMarkerControlType(int marker, ERMarkerControlType type) : bool; // Spline, StraightXZ, StraightXZY, Circular // find a road // public static function ERRoadNetwork.GetRoadByName(string name) : ERRoad; // get all roads // public static function ERRoadNetwork.GetRoads() : ERRoad[]; // snap vertices to the terrain (no terrain deformation) // road.SnapToTerrain(true); // Build Road Network roadNetwork.BuildRoadNetwork(); // remove script components // roadNetwork.Finalize(); // Restore Road Network // roadNetwork.RestoreRoadNetwork(); // Show / Hide the white surfaces surrounding roads // public function roadNetwork.HideWhiteSurfaces(bool value) : void; // road.GetConnectionAtStart(): GameObject; // road.GetConnectionAtStart(out int connection): GameObject; // connections: 0 = bottom, 1= tip, 2 = left, 3 = right (the same for T crossings) // road.GetConnectionAtEnd(): GameObject; // road.GetConnectionAtEnd(out int connection): GameObject; // connections: 0 = bottom, 1= tip, 2 = left, 3 = right (the same for T crossings) // Snap the road vertices to the terrain following the terrain shape (no terrain deformation) // road.SnapToTerrain(bool value): void; // road.SnapToTerrain(bool value, float yOffset): void; // get the road length // road.GetLength() : float; // create dummy object go = GameObject.CreatePrimitive(PrimitiveType.Cube); }