EasyRoads3D V3 Manual
 

 

ERRoadNetwork


Description

This is the base class for an EasyRoads3D road network

 

Constructors

public ERRoadNetwork()

Creates a new road object in the scene or creates a reference to an already existing road network in the scene created in the Unity editor.

 

Functions

 

public void BuildRoadNetwork()

Builds the final road network and manipulates the terrain accordingly

 

public void BuildRoadNetwork(bool splatmaps, bool trees, bool detail)

Builds the final road network and manipulates the terrain according the passed parameters

 

public void BuildRoadNetwork(bool splatmaps, bool trees, bool detail, ERRoad[] roads)

Builds the final road network and manipulates the terrain according the passed parameters. The terrain will only be updated according the passed array of road objects.

NOTE: RestoreRoadNetwork() will target the last build process. Do not use the above consecutively without restoring the road network first if you do want to be able to restore the full road network. This mainly relates to restoring the terrain to its original state of before creating the road network.

 

public ERRoad ConnectRoads(ERRoad road1, ERRoad road2)

Connects two roads at the nearest markers.

 

public ERRoad ConnectRoads(ERRoad road1, int markerIndex1, ERRoad road2, int markerIndex2)

Connects two roads between markerIndex1 and markerIndex2.

 

public ERRoad CreateRoad(string name)

Creates a new road object and returns it

 

public ERRoad CreateRoad(string name, Vector3[] markers)

Creates and builds a new road object according the passed array of marker positons and returns it

 

public ERRoad CreateRoad(string name, ERRoadType type)

Creates and a new road object of ERRoadType type and returns it

 

public ERRoad CreateRoad(string name, ERRoadType type, Vector3[] markers)

Creates and builds a new road object of ERRoadType type and according the passed array of marker positons and returns it

 

public void FinalizeObjects()

This will remove all script components from all road network game objects including the main road network script.

 

public ERConnection GetConnectionByName(string name)

Returns the connection in the scene matching name

 

public ERConnection[] GetConnections()

Returns all available connections

 

public float GetRaiseOffset()

Returns the raise level of the road network relative to the terrain height

 

public ERRoad[] GetRoads()

Returns all exisiting road objects

 

public ERRoad GetRoadByGameObject(GameObject object)

Finds a road object by GameObject and returns it

 

public ERRoad GetRoadByName(string name)

Finds a road object by name and returns it

 

public ERRoadType GetRoadTypeByName(string name)

Finds a road type by name and returns it

 

public ERRoadType[] GetRoadTypes()

Returns all available road types

 

public ERConnection GetSourceConnectionByName(string name)

Returns the source connection in resources/custom prefabs or resources/dynamic prefabs matching name

 

public void HideWhiteSurfaces(bool value)

Enables/disables visibility of the white surfaces surrounding the road objects

 

public ERConnection InstantiateConnection(ERConnection sourceConnection, string name, Vector3 position, Vector3 euler)

Instantiates, names and returns a new connection object according the passed sourceConnection, name, position and euler rotation angles

 

public ERConnection[] LoadConnections()

Returns all available connections in the Resources folder

 

public void RestoreRoadNetwork()

Restores the road network back to edit mode

 

public void SetRaiseOffset(float value)

This will raise the road network in Build Mode above the terrain according the passed value

 

public void Translate(Vector3 translation)

This will move the entire road network according the Vector3 translation