EasyRoads3D V3 Manual
 

 

ERRoad


Description

This is the base class for an EasyRoads3D road object

 

Constructors

...

 

Functions

 

public void AddMarker(Vector3 position)

Adds a new marker

 

public void AddMarkers(Vector3[] pos)

Adds new markers according an array of Vector3 positions

 

public ERConnection AttachToEnd(ERConnection sourceConnection, int connectionIndex)

Instantiates and connects a new ERConnection object according the sourceConnection to the connection connectionIndex at the end of the road. Returns null in the case a connection is already connected to the end or when sourceConnection is not a valid connection object.

 

public ERConnection AttachToStart(ERConnection sourceConnection, int connectionIndex)

Instantiates and connects a new ERConnection object according the sourceConnection to the connection connectionIndex at the start of the road. Returns null in the case the new connection object could not be created because a connection is already connected to the start or when sourceConnection is not a valid connection object.

 

public bool ClosedTrack(bool value)

Activate/deactivate closed track.

 

public bool ConnectToEnd(ERConnection connectionObject, int connectionIndex)

Connects the already exisiting ERConnection connectionObject to the connection connectionIndex at the end of the road. Returns false in the case a connection is already connected to the start or when connectionObject is not a valid connection object.

 

public bool ConnectToStart(ERConnection connectionObject, int connectionIndex)

Connects the already exisiting ERConnection connectionObject to the connection connectionIndex at the start of the road. Returns false in the case a connection is already connected to the start or when connectionObject is not a valid connection object.

 

public void DeleteMarker(int index)

Deleted the marker at the passed index

 

public bool Destroy()

Removes the road object

 

public float GetAngleThreshold()

Returns the Angle Threshold of the road object

 

public ERConnection GetConnectionAtEnd()

Returns the crossing/connection at the end of the road

 

public ERConnection GetConnectionAtEnd(out int index)

Returns the crossing/connection at the end of the road, index holds the connection index

 

public ERConnection GetConnectionAtStart()

Returns the crossing/connection at the start of the road

 

public ERConnection GetConnectionAtStart(out int index)

Returns the crossing/connection at the start of the road, index holds the connection index

 

public float GetLength()

Returns the length of the road object

 

public Vector3 GetMarkerPosition(int index)

Returns the position of the marker at index

 

public Vector3[] GetMarkerPositions()

Returns all marker positions

 

public string GetName()

Returns the name of the road object

 

public Vector3 GetPosition(float value, ref int currentElement)

Returns the center position of the road at distance value. currentElement can be used for performance optimization.

 

public Vector3 GetMarkerTilting(int index)

Returns the tilting value of the marker at index

 

public Vector3 GetMarkerTiltingCenter(int index)

Returns the tilting center of the marker at index

 

public Vector3[] GetSplinePointsCenter()

Returns pre-sampled positions at the center of the road

 

public Vector3[] GetSplinePointsRightSide()

Returns pre-sampled positions at the right side of the road

 

public Vector3[] GetSplinePointsLeftSide()

Returns pre-sampled positions at the left side of the road

 

public void InsertMarker(Vector3 pos)

Inserts a new marker before the selected marker

 

public void InsertMarkerAt(Vector3 pos, int index)

Inserts a new marker before the passed index

 

public ERRoad InsertIConnector(int index, string connectionName, out ERConnection connection)

Inserts an I Connector at marker index. connectionName will be assigned as the connection name and the new connection object will be assigned to connection. If this index is not at the start or end of the road, the road object will be cut and the newly created road will be returned.

 

public ERRoad InsertIConnector(int index)

Inserts an I Connector at marker index. If this index is not at the start or end of the road, the road object will be cut and the newly created road will be returned.

 

public ERRoadType GetRoadType()

Returns the road type

 

public void IsSideObject(bool value)

Marks the road object as a side object, no road mesh will be created

 

public void IsStatic(bool value)

Marks the road object as static/none static

 

public void SetLayer(int index)

Sets the layer of the road game object to index

 

public bool SetMarkerControlType(int index, ERMarkerControlType type)

Sets the ERMarkerControlType type for the marker at index. Enum options are: Spline, StraightXZ, StraightXZY, Circular

 

public void SetMarkerPosition(int index, Vector3 position)

This will update the marker position at index to position

 

public void SetMarkerPositions(Vector3[] positions)

This will update all marker positions provided that the passed array length matches the markers length

 

public void SetMarkerPositions(Vector3[] positions, int index)

This will update all marker positions corresponding to the passed array length starting at index

 

public void SetMarkerTilting(float value, int index)

This will set the tilting level of the marker at index. Value represents the tilting angle

 

public void SetMarkerTiltingCenter(float value, int index)

This will set the tilting center of the marker at index. value represents the position between the left and the right side of the road (0..1)

 

public void SetMaterial(Material mat)

This will assign the passed material to the road. It is recommended to use road types which includes the road material

 

public void SetMeshCollider(bool value)

Adds or removes the mesh collider

 

public void SetName(string name)

Updates the name of the road object

 

public void SetResolution(float res)

Set the resolution of the road object

 

public float GetResolution()

Returns the resolution of the road object

 

public Color GetVertexColor(int index)

Returns the vertex color of the marker at index.

 

public float GetWidth()

Returns the width of the road object

 

public void SetAngleThreshold(float res)

Set the Angle Threshold of the road object

 

public void SetRoadType(ERRoadType rt)

This will update the full road to match the passed road type

 

public void SetSplatmap(bool active)

This will blend the road shape in the terrain splatmap

 

public void SetSplatmap(bool active, int splatIndex , int expand, int smoothLevel, float opacity)

This will blend the road shape in the terrain splatmap. Additionally the splatmap parameters will be passed for the terrain splat texture index, width expansion, smooth level and opacity

 

public void SetSplineStrength(int index, float strength)

Sets the spline strength of the marker at index.

 

public void SetWidth(float width)

Sets the width of the road object. It is recommended to use road types which includes the width.

 

public void SetVertexColor(int index, Color color)

Sets the vertex color of the marker at index.

 

public void SnapToTerrain(bool value)

When active, road vertices will snap to the terrain. No terrain deformation will take place for this road object.

 

public void SnapToTerrain(bool value, float value)

When active, road vertices will snap to the terrain with an offset value. No terrain deformation will take place for this road object.

 

public void UnConnectEnd()

Removes the connection at the end of the road object.

 

public void UnConnectStart()

Removes the connection at the start of the road object.