Highroad Engine v1.3
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoreMountains.HighroadEngine.SkidmarksManager Class Reference

This class handles mesh generation for skidmarks, for all vehicles in the scene. You just have to put an instance of it in your scene. Note : this class is inspired by the Unity Car Tutorial skidmarks script, and optimized to improve performance. More...

Inheritance diagram for MoreMountains.HighroadEngine.SkidmarksManager:

Classes

class  Section
 a mark's section, used to store the mesh data More...
 

Public Member Functions

virtual int AddSkidMark (Vector3 position, Vector3 normal, float intensity, int lastIndex)
 Adds a new trace This method must be called from the wheel's code to add a mark at the desired moment More...
 

Public Attributes

int MaxMarksNumber = 1024
 The maximum amount of skidmarks stored. Above this number, old skidmarks are destroyed. This number is shared between all vehicles. More...
 
float MarkWidth = 0.2f
 the width of the skidmarks at ground level More...
 
float GroundDistance = 0.02f
 the offset between the mark and the ground More...
 

Static Public Attributes

const float DistanceBetweenMarks = 0.5f
 the minimal distance between each point of the mark More...
 

Protected Member Functions

virtual void Start ()
 Initalizes the array storing skidmarks and elements used for marks More...
 
virtual void LateUpdate ()
 Checks wether a mark should be added and updates the mesh if needed More...
 
virtual void UpdateMesh ()
 Mesh update More...
 

Protected Attributes

Section[] _skidmarksArray
 
Vector3[] _verticesArray
 
Vector3[] _normalsArray
 
Vector4[] _tangentsArray
 
Color32[] _colorsArray
 
Vector2[] _uvsArray
 
int[] _trianglesArray
 
bool _needNewSkidmark
 
MeshFilter _meshFilter
 
Mesh _mesh
 
int markIndex
 
bool _firstInitializationOfBoundsDone
 

Detailed Description

This class handles mesh generation for skidmarks, for all vehicles in the scene. You just have to put an instance of it in your scene. Note : this class is inspired by the Unity Car Tutorial skidmarks script, and optimized to improve performance.

Member Function Documentation

◆ AddSkidMark()

virtual int MoreMountains.HighroadEngine.SkidmarksManager.AddSkidMark ( Vector3  position,
Vector3  normal,
float  intensity,
int  lastIndex 
)
virtual

Adds a new trace This method must be called from the wheel's code to add a mark at the desired moment

Returns
The skid mark index.
Parameters
positionThe mark's position.
normalGround normal.
intensityIntensity of the mark (from 0 to 1).
lastIndexPrevious mark index for that wheel.

◆ LateUpdate()

virtual void MoreMountains.HighroadEngine.SkidmarksManager.LateUpdate ( )
protectedvirtual

Checks wether a mark should be added and updates the mesh if needed

◆ Start()

virtual void MoreMountains.HighroadEngine.SkidmarksManager.Start ( )
protectedvirtual

Initalizes the array storing skidmarks and elements used for marks

◆ UpdateMesh()

virtual void MoreMountains.HighroadEngine.SkidmarksManager.UpdateMesh ( )
protectedvirtual

Mesh update

Member Data Documentation

◆ _colorsArray

Color32 [] MoreMountains.HighroadEngine.SkidmarksManager._colorsArray
protected

◆ _firstInitializationOfBoundsDone

bool MoreMountains.HighroadEngine.SkidmarksManager._firstInitializationOfBoundsDone
protected

◆ _mesh

Mesh MoreMountains.HighroadEngine.SkidmarksManager._mesh
protected

◆ _meshFilter

MeshFilter MoreMountains.HighroadEngine.SkidmarksManager._meshFilter
protected

◆ _needNewSkidmark

bool MoreMountains.HighroadEngine.SkidmarksManager._needNewSkidmark
protected

◆ _normalsArray

Vector3 [] MoreMountains.HighroadEngine.SkidmarksManager._normalsArray
protected

◆ _skidmarksArray

Section [] MoreMountains.HighroadEngine.SkidmarksManager._skidmarksArray
protected

◆ _tangentsArray

Vector4 [] MoreMountains.HighroadEngine.SkidmarksManager._tangentsArray
protected

◆ _trianglesArray

int [] MoreMountains.HighroadEngine.SkidmarksManager._trianglesArray
protected

◆ _uvsArray

Vector2 [] MoreMountains.HighroadEngine.SkidmarksManager._uvsArray
protected

◆ _verticesArray

Vector3 [] MoreMountains.HighroadEngine.SkidmarksManager._verticesArray
protected

◆ DistanceBetweenMarks

const float MoreMountains.HighroadEngine.SkidmarksManager.DistanceBetweenMarks = 0.5f
static

the minimal distance between each point of the mark

◆ GroundDistance

float MoreMountains.HighroadEngine.SkidmarksManager.GroundDistance = 0.02f

the offset between the mark and the ground

◆ markIndex

int MoreMountains.HighroadEngine.SkidmarksManager.markIndex
protected

◆ MarkWidth

float MoreMountains.HighroadEngine.SkidmarksManager.MarkWidth = 0.2f

the width of the skidmarks at ground level

◆ MaxMarksNumber

int MoreMountains.HighroadEngine.SkidmarksManager.MaxMarksNumber = 1024

The maximum amount of skidmarks stored. Above this number, old skidmarks are destroyed. This number is shared between all vehicles.


The documentation for this class was generated from the following file: