Particle Playground - Script Reference  3.0.1
Framework for controlling particles in the Unity Engine.
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
ParticlePlayground.ParticlePlaygroundTrail Class Reference

Public Member Functions

 ParticlePlaygroundTrail ()
 Initializes a new instance of the ParticlePlayground.ParticlePlaygroundTrail class. More...
 
 ParticlePlaygroundTrail (int pointCache)
 Initializes a new instance of the ParticlePlayground.ParticlePlaygroundTrail class and specifies the available point cache. The mesh's available vertices, normals, uvs, triangles and colors will be based on the specified point cache. More...
 
void UpdateCache ()
 Updates the mesh cache. This is done upon creation where cache lengths will be based on the point cache. More...
 
void UpdateMesh ()
 Updates the trail mesh. This is done each frame from the main-thread. More...
 
void RecalculateBounds ()
 Recalculates the bounds on the trail mesh. This is done automatically when triangles are set into a mesh. More...
 
void ClearMesh ()
 Clears the trail mesh. More...
 
void SetFirstPoint (Vector3 pos, Vector3 dir, float startWidth, float lifetime)
 Sets the first point in the trail. This will add two initial points, one starting point and one ending point which will follow the assigned particle. More...
 
void SetLastPoint (Vector3 pos, Vector3 dir, float startWidth, float lifetime)
 Sets the last point in the trail and then kills it. This will add one last point which won't follow the assigned particle. More...
 
void AddPoint (Vector3 position, float width, float lifetime)
 Adds a point into the end of the trail. More...
 
void AddPoint (Vector3 position, Vector3 velocity, float width, float lifetime)
 Adds a point into the end of the trail. More...
 
void RemovePoint (int index)
 
void SetColor (int index, Color32 color)
 Sets the color at specified index. This is done automatically through the trail calculation loop. More...
 
void NextPoint ()
 Makes the iterator jump to next point. The iterator controls which point is following the particle. More...
 
float GetParticleTime ()
 Gets the paired particle's current time. More...
 
void SetParticleTime (float time)
 Sets the paired particle's current time. More...
 
Vector3 GetParticlePosition ()
 Gets the paired particle's current position. More...
 
void SetParticlePosition (Vector3 position)
 Sets the paired particle's position. More...
 
void SetParticleDirection (Vector3 direction)
 Sets the paired particle's direction. More...
 
Vector3 GetLastAddedPointPosition ()
 Gets the last added point position. More...
 
Vector3 GetParticleDirection ()
 Gets the direction of the particle. More...
 
Vector3 GetLastAddedPointDirection ()
 
float GetPathDeviation ()
 Gets the current path deviation angle based on the last added point direction and the current direction of the particle. More...
 
int GetBirthIterator ()
 Gets the birth iterator used for iterating through the mesh arrays to set new vertex positions. More...
 
int GetDeathIterator ()
 Gets the death iterator used for iterating through the mesh arrays to remove old vertex positions. More...
 
int GetPointCache ()
 Gets the point cache amount. The point cache is set at the trail's creation and determines how many vertices, triangles, uvs, normals and colors the trail mesh can have. More...
 
float TimeCached ()
 Gets the time this trail was cached. More...
 
bool CanRemovePoint (int point)
 Determines whether this trail can remove a point at specified index. More...
 
bool CanRemoveTrail ()
 Determines whether this trail can be removed. This will check if the last point in the trail has reached the end of its lifetime. More...
 
void WakeUp ()
 Wakes up the trail from being dead. More...
 
void Die ()
 Makes the trail stop following its assigned particle. More...
 
bool IsDead ()
 Determines whether this trail is dead. More...
 

Public Attributes

bool update = true
 Determines if this ParticlePlaygroundTrail should update. More...
 
GameObject trailGameObject
 The GameObject of this trail. More...
 
Transform trailTransform
 The Transform of this trail. More...
 
MeshRenderer trailRenderer
 The Mesh Renderer component of this trail. More...
 
MeshFilter trailMeshFilter
 The Mesh Filter component of this trail. More...
 
Mesh trailMesh
 The Mesh component of this trail. More...
 
int particleId
 The particle this trail is following. More...
 
int minPointCache = 2
 The minimum point cache limit. More...
 
int maxPointCache = 32767
 The maximum point cache limit. More...
 
List< TrailPointtrailPoints = new List<TrailPoint>()
 
Vector3[] meshVerticesCache
 
Vector3[] meshNormalsCache
 
Vector2[] meshUvsCache
 
int[] meshTrianglesCache
 
Color32[] meshColorsCache
 

Constructor & Destructor Documentation

ParticlePlayground.ParticlePlaygroundTrail.ParticlePlaygroundTrail ( )

Initializes a new instance of the ParticlePlayground.ParticlePlaygroundTrail class.

ParticlePlayground.ParticlePlaygroundTrail.ParticlePlaygroundTrail ( int  pointCache)

Initializes a new instance of the ParticlePlayground.ParticlePlaygroundTrail class and specifies the available point cache. The mesh's available vertices, normals, uvs, triangles and colors will be based on the specified point cache.

Parameters
pointCacheMesh point cache (vertices, normals and uvs will be multiplied by two, triangles by six).

Member Function Documentation

void ParticlePlayground.ParticlePlaygroundTrail.AddPoint ( Vector3  position,
float  width,
float  lifetime 
)

Adds a point into the end of the trail.

Parameters
positionPosition.
widthWidth.
lifetimeLifetime.
void ParticlePlayground.ParticlePlaygroundTrail.AddPoint ( Vector3  position,
Vector3  velocity,
float  width,
float  lifetime 
)

Adds a point into the end of the trail.

Parameters
positionPosition.
velocityInitial Velocity.
widthWidth.
lifetimeLifetime.
bool ParticlePlayground.ParticlePlaygroundTrail.CanRemovePoint ( int  point)

Determines whether this trail can remove a point at specified index.

Returns
true if this trail can remove a point at the specified index; otherwise, false.
Parameters
pointPoint.
bool ParticlePlayground.ParticlePlaygroundTrail.CanRemoveTrail ( )

Determines whether this trail can be removed. This will check if the last point in the trail has reached the end of its lifetime.

Returns
true if this trail can be removed; otherwise, false.
void ParticlePlayground.ParticlePlaygroundTrail.ClearMesh ( )

Clears the trail mesh.

void ParticlePlayground.ParticlePlaygroundTrail.Die ( )

Makes the trail stop following its assigned particle.

int ParticlePlayground.ParticlePlaygroundTrail.GetBirthIterator ( )

Gets the birth iterator used for iterating through the mesh arrays to set new vertex positions.

Returns
The birth iterator.
int ParticlePlayground.ParticlePlaygroundTrail.GetDeathIterator ( )

Gets the death iterator used for iterating through the mesh arrays to remove old vertex positions.

Returns
The death iterator.
Vector3 ParticlePlayground.ParticlePlaygroundTrail.GetLastAddedPointPosition ( )

Gets the last added point position.

Returns
The last added point position.
Vector3 ParticlePlayground.ParticlePlaygroundTrail.GetParticleDirection ( )

Gets the direction of the particle.

Returns
The particle direction.
Vector3 ParticlePlayground.ParticlePlaygroundTrail.GetParticlePosition ( )

Gets the paired particle's current position.

Returns
The paired particle's position.
float ParticlePlayground.ParticlePlaygroundTrail.GetParticleTime ( )

Gets the paired particle's current time.

Returns
The paired particle's current time.
float ParticlePlayground.ParticlePlaygroundTrail.GetPathDeviation ( )

Gets the current path deviation angle based on the last added point direction and the current direction of the particle.

Returns
The path deviation angle.
int ParticlePlayground.ParticlePlaygroundTrail.GetPointCache ( )

Gets the point cache amount. The point cache is set at the trail's creation and determines how many vertices, triangles, uvs, normals and colors the trail mesh can have.

Returns
The point cache amount.
bool ParticlePlayground.ParticlePlaygroundTrail.IsDead ( )

Determines whether this trail is dead.

Returns
true if this trail is dead; otherwise, false.
void ParticlePlayground.ParticlePlaygroundTrail.NextPoint ( )

Makes the iterator jump to next point. The iterator controls which point is following the particle.

void ParticlePlayground.ParticlePlaygroundTrail.RecalculateBounds ( )

Recalculates the bounds on the trail mesh. This is done automatically when triangles are set into a mesh.

void ParticlePlayground.ParticlePlaygroundTrail.SetColor ( int  index,
Color32  color 
)

Sets the color at specified index. This is done automatically through the trail calculation loop.

Parameters
indexIndex.
colorColor.
void ParticlePlayground.ParticlePlaygroundTrail.SetFirstPoint ( Vector3  pos,
Vector3  dir,
float  startWidth,
float  lifetime 
)

Sets the first point in the trail. This will add two initial points, one starting point and one ending point which will follow the assigned particle.

Parameters
posPosition.
dirDirection.
startWidthStart width.
lifetimeLifetime.
void ParticlePlayground.ParticlePlaygroundTrail.SetLastPoint ( Vector3  pos,
Vector3  dir,
float  startWidth,
float  lifetime 
)

Sets the last point in the trail and then kills it. This will add one last point which won't follow the assigned particle.

Parameters
posPosition.
dirDirection.
startWidthStart width.
lifetimeLifetime.
void ParticlePlayground.ParticlePlaygroundTrail.SetParticleDirection ( Vector3  direction)

Sets the paired particle's direction.

Parameters
directionDirection.
void ParticlePlayground.ParticlePlaygroundTrail.SetParticlePosition ( Vector3  position)

Sets the paired particle's position.

Parameters
positionPosition.
void ParticlePlayground.ParticlePlaygroundTrail.SetParticleTime ( float  time)

Sets the paired particle's current time.

Parameters
timeTime.
float ParticlePlayground.ParticlePlaygroundTrail.TimeCached ( )

Gets the time this trail was cached.

Returns
The cached time.
void ParticlePlayground.ParticlePlaygroundTrail.UpdateCache ( )

Updates the mesh cache. This is done upon creation where cache lengths will be based on the point cache.

void ParticlePlayground.ParticlePlaygroundTrail.UpdateMesh ( )

Updates the trail mesh. This is done each frame from the main-thread.

void ParticlePlayground.ParticlePlaygroundTrail.WakeUp ( )

Wakes up the trail from being dead.

Member Data Documentation

int ParticlePlayground.ParticlePlaygroundTrail.maxPointCache = 32767

The maximum point cache limit.

int ParticlePlayground.ParticlePlaygroundTrail.minPointCache = 2

The minimum point cache limit.

int ParticlePlayground.ParticlePlaygroundTrail.particleId

The particle this trail is following.

GameObject ParticlePlayground.ParticlePlaygroundTrail.trailGameObject

The GameObject of this trail.

Mesh ParticlePlayground.ParticlePlaygroundTrail.trailMesh

The Mesh component of this trail.

MeshFilter ParticlePlayground.ParticlePlaygroundTrail.trailMeshFilter

The Mesh Filter component of this trail.

MeshRenderer ParticlePlayground.ParticlePlaygroundTrail.trailRenderer

The Mesh Renderer component of this trail.

Transform ParticlePlayground.ParticlePlaygroundTrail.trailTransform

The Transform of this trail.

bool ParticlePlayground.ParticlePlaygroundTrail.update = true

Determines if this ParticlePlaygroundTrail should update.


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