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 connectionPrefab, int connectionIndex)

Instantiates and connects a new ERConnection object according the connectionPrefab 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 connectionPrefab is not a valid connection object.

 

public ERConnection AttachToStart(ERConnection connectionPrefab, int connectionIndex)

Instantiates and connects a new ERConnection object according the connectionPrefab 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 connectionPrefab is not a valid connection object.

 

public bool ClampUVs(bool value)

Generate UVs clamped to 0 at start and 1 at end. This is by default the case. Setting this to false is for example useful for never ending roads created at runtime where markers behind the cam are removed. The UVs at the new start will be generated relative to the same decimal value as for the previous road update.

 

public bool ClosedTrack(bool value)

Activate/deactivate closed track.

 

public bool IsClosedTrack()

Returns the current status of 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 markerIndex)

Deleted the marker at the passed markerIndex

 

public bool FollowTerrainContours(bool value)

Adjust the shape of the road to the terrain shape. The terrain will still be adjusted according the indent and surrounding values.

 

public bool FollowTerrainContours(int markerIndex, bool value)

Adjusts the status of "Follow Terrain Contours" for the passed marker 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 GetDistance()

Returns the distance of the road object

 

public float GetDistance(int markerIndex)

Returns the distance of the section at markerIndex

 

public int GetMarkerCount()

Returns the total number of markers

 

public Vector3 GetMarkerPosition(int markerIndex)

Returns the position of the marker at markerIndex

 

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 ERMarkerControlType GetMarkerControlType(int markerIndex)

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

 

public Vector3 GetMarkerTilting(int markerIndex)

Returns the tilting value of the marker at markerIndex

 

public Vector3 GetMarkerTiltingCenter(int markerIndex)

Returns the tilting center of the marker at markerIndex

 

public float GetResolution()

Returns the resolution of the road object

 

public Vector2[] GetRoadShapeNodes(int markerIndex)

Returns the roadshape node data in a Vector2[] of the marker at markerIndex.

 

public ERRoadType GetRoadType()

Returns the road type

 

public bool GetSideObjectActiveState(SideObject obj)

Returns the active state of the passed side object for this road object

 

public bool GetSideObjectMarkerActiveState(SideObject obj, in markerIndex)

Returns the active state of the passed side object for this road object for the passed markerIndex

 

public ERRoadSide GetSideObjectMarkerActiveStateSides(SideObject obj, in markerIndex)

This is for side objects that are set as Dual Sided, side objects that can be generated on both the left and right side. It returns on which sides the passed side object is active for this road object for the passed markerIndex.

 

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 Vector3[] GetSplineStrength(int markerIndex)

Returns the spline strength of the marker at markerIndex.

 

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 ERConnection InsertConnector(ERConnection connectionObject, int index, int connectionIndex1, int connectionIndex2, out ERRoad road)

Splits the road in two sections and Inserts the connectionObject at marker index to connectionIndex1 and connects the second section to connectionIndex2. The insreted Connection instance will be returned

 

public int InsertMarker(Vector3 position)

Inserts a new marker before the marker at the end of the section nearest to position and returns the newmarker index

 

public void InsertMarkerAt(Vector3 pos, int markerIndex)

Inserts a new marker before the passed markerIndex

 

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

Inserts an I Connector at marker markerIndex. 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 markerIndex)

Inserts an I Connector at marker markerIndex. 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 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 FollowTerrainContourThreshold(float value)

The contour threshold value controls the smoothness, how accurately the road should follow the terrain slopes

 

public float SetIndent( float value, int markerIndex)

This will set the indent value on both the left and right side of the road for the marker at markerIndex. The value will be adjusted and returned should the passed value be lower then the minimum required indent value. This requires Refresh() in the ERRoad class to update the instance.

 

public float SetIndent( float value, int markerIndex, ERRoadSide type)

This will set the indent value marker at markerIndex on the left side (ERRoadSide.Left), on the right side (ERRoadSide.Both) or on both sides (ERRoadSide.Both). The value will be adjusted and returned should the passed value be lower then the minimum required indent value. This requires Refresh() in the ERRoad class to update the instance.

 

public float SetIndentAlignment(ERIndentAlignment value, int markerIndex, ERRoadSide type)

This will set the alignment of the indent position marker at markerIndex. By default the indent position is aligned with the road (ERIndentAlignment.Road). Other options are the terrain height at the indent position (ERIndentAlignment.Terrain) or the terrain height at the surrounding poisition (ERIndentAlignment.Surrounding). This can be set for the left side of the road (ERRoadSide.Left), the right side (ERRoadSide.Right) or both sides ((ERRoadSide.Both).

 

public void SetLayer(int index)

Sets the layer of the road game object to index

 

public bool SetMarkerControlType(int markerIndex, ERMarkerControlType type)

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

 

public void SetMarkerPosition(int markerIndex, Vector3 position)

This will update the marker position at markerIndex 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 markerIndex)

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

 

public void SetMarkerTilting(float value, int markerIndex)

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

 

public void SetMarkerTiltingCenter(float value, int markerIndex)

This will set the tilting center of the marker at markerIndex. 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 SetSideObjectOffset(SideObject obj, int markerIndex, OffsetPosition position, float value)

This will start / end the side object obj at marker markerIndex at position (OffsetPosition.Start or OffsetPosition.End) according the passed value

 

public float SetSideObjectOffset(SideObject obj, int markerIndex, OffsetPosition position, float value, bool refresh)

This will start / end the side object obj at marker markerIndex at position (OffsetPosition.Start or OffsetPosition.End) according the passed value. The refresh value option can be used to set values for different road marker indexes and only update the side object once at the end.

 

public void SetSideObjectXPosition(SideObject obj, int markerIndex, float value)

This will set the "X Position" value at marker markerIndex according the passed value

 

public void SetSideObjectXPosition(SideObject obj, int markerIndex, float value, bool refresh)

This will set the "X Position" value at marker markerIndex according the passed value. The refresh value option can be used to set values for different road marker indexes and only update the side object once at the end.

 

public void SetSideObjectXPosition(SideObject obj, int markerIndex, SideObjectSide side, float value)

This will set the "X Position" value at marker markerIndex according the passed value athe road side specified by side, SideObjectSide.DefaultSide or SideObjectSide.OtherSide

 

public void SetSideObjectXPosition(SideObject obj, int markerIndex, SideObjectSide side, float value, bool refresh)

This will set the "X Position" value at marker markerIndex according the passed value athe road side specified by side, SideObjectSide.DefaultSide or SideObjectSide.OtherSide. The refresh value option can be used to set values for different road marker indexes and only update the side object once at the end.

 

public void SetStartLevelDistance(int markerIndex, float value)

This will set the deformation start level distance for bridges according the passed value at the passed markerIndex. The terrain will be leveled gradually from the road height to the terrain height over the specified distance

 

public void SetEndLevelDistance(int markerIndex, float value)

This will set the deformation end level distance for bridges according the passed value at the passed markerIndex. The terrain will be leveled gradually from the road height to the terrain height over the specified distance

 

public float SetSurrounding(float value, int markerIndex)

This will set the surrounding value on both the left and right side of the road for the marker at markerIndex.

 

public float SetSurrounding(float value, int markerIndex, ERRoadSide type)

This will set the surrounding value marker at markerIndex on the left side (ERRoadSide.Left), on the right side (ERRoadSide.Both) or on both sides (ERRoadSide.Both). This requires Refresh() in the ERRoad class to update the instance.

 

public float SetSurrounding(float value, int markerIndex, ERRoadSide type)

This will set the surrounding value marker at markerIndex on the left side (ERRoadSide.Left), on the right side (ERRoadSide.Both) or on both sides (ERRoadSide.Both). This requires Refresh() in the ERRoad class to update the instance.

 

public void SetAngleThreshold(float res)

Set the Angle Threshold of the road object

 

public void SetRandomBumpiness(float minHeight, float maxHeight, float minDistance, float maxDistance)

Add random bumpiness to the road with a random strength between minHeight and maxHeight over a random distance between minDistance and maxDistance

 

public void SetRandomBumpiness(int markerIndex, float minHeight, float maxHeight, float minDistance, float maxDistance)

Add random bumpiness to marker at markerIndex with a random strength between minHeight and maxHeight over a random distance between minDistance and maxDistance

 

public void SetRandomTilting(float minAngle, float maxAngle, float minDistance, float maxDistance)

Add random tilting to the road with a random angle between minAngle and maxAngle over a random distance between minDistance and maxDistance

 

public void SetRandomTilting(int markerIndex, float minAngle, float maxAngle, float minDistance, float maxDistance)

Add random bumpiness to marker at markerIndex with a random strength between minAngle and maxAngle over a random distance between minDistance and maxDistance

 

public void SetRoadShapeNodes(int[] markerIndexes, Vector2[] nodes)

Updates the road shape for the section for all passed markerIndexes according the passed Vector2[] node data

 

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 markerIndex, float strength)

Sets the spline strength of the marker at markerIndex.

 

public void SetTerrainDeformation(bool value)

Toggles on/off terrain deformation for this road according the passed value.

 

public void SetTerrainDeformation(int markerIndex, bool value)

Toggles on/off terrain deformation for markerIndex. This requires Refresh()

 

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 markerIndex, Color color)

Sets the vertex color of the marker at markerIndex.

 

public void SideObjectSetActive(SideObject obj, bool value)

This activates / deactivates side object obj, on this road according value.

 

public void SideObjectMarkerSetActive(SideObject obj, int markerIndex, bool value)

This activates / deactivates side object obj, on this road for the marker at markerIndex according value.

 

public void SideObjectMarkerSetActive(SideObject obj, int[] markerIndexes, bool value)

This activates / deactivates side object obj, on this road for all markers in the array markerIndexes according value.

 

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 ERRoad SplitRoad(int markerIndex)

This will split the road at markerIndexes and return the newly created ERRoad 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.