devNotes 5-09-16 events, vizEls and spinerettes

jupiter9

int ParticlePlayground.PlaygroundParticlesC.Emit()
	
Emits a single particle at previously set scripted emission position, velocity and color.


int ParticlePlayground.PlaygroundParticlesC.Emit(Vector3 givePosition)
	
Emits a single particle at position with previously set scripted emission velocity and color.

Parameters
givePosition	Position.


int ParticlePlayground.PlaygroundParticlesC.Emit(Vector3 givePosition, Vector3 giveVelocity)
		
Emits a single particle at position with velocity, the color will be set from the previous scripted emission color.

Parameters
givePosition	Position.
giveVelocity	Velocity.


int ParticlePlayground.PlaygroundParticlesC.Emit(Vector3 givePosition, Vector3 	giveVelocity, Color32 giveColor)
	
Emits a single particle at position with velocity and color (Source Mode SOURCEC.Script will be automatically set).

Parameters
givePosition	Position.
giveVelocity	Velocity.
giveColor	Color.


void ParticlePlayground.PlaygroundParticlesC.Emit(int quantity)
	
Emits number of particles set by quantity. All other values will be set from the previous scripted emission call (or as set in Inspector).

Parameters
quantity	Quantity.


void ParticlePlayground.PlaygroundParticlesC.Emit(int quantity,
Vector3 	givePosition,
Vector3 	randomVelocityMin,
Vector3 	randomVelocityMax,
Color32 	giveColor 
)	
	
Emits number of particles set by quantity, position and minimum - maximum random velocity.

Parameters
quantity		Quantity.
givePosition		Position.
randomVelocityMin	Random minimum velocity.
randomVelocityMax	Random maximum velocity.
giveColor		Color.


void ParticlePlayground.PlaygroundParticlesC.Emit(int quantity,
Vector3 	randomPositionMin,
Vector3 	randomPositionMax,
Vector3 	randomVelocityMin,
Vector3 	randomVelocityMax,
Color32 	giveColor 
)
		
Emits number of particles set by quantity, minimum - maximum random position and velocity.

Parameters
quantity		Quantity.
randomPositionMin	Random position minimum.
randomPositionMax	Random position max.
randomVelocityMin	Random velocity minimum.
randomVelocityMax	Random velocity max.
giveColor		Color.


int ParticlePlayground.PlaygroundParticlesC.Emit(float 	giveLifetime)	
Emits a single particle with specified lifetime. This will set particle position, velocity and color from previously called emission (as set in the Source tab).

Parameters
giveLifetime	Lifetime.
int ParticlePlayground.PlaygroundParticlesC.Emit(Vector3 givePosition,float giveLifetime)
		
Emits a single particle with specified lifetime. This will set particle velocity and color from previously called emission (as set in the Source tab).

Parameters
givePosition	Position.
giveLifetime	Lifetime.

int ParticlePlayground.PlaygroundParticlesC.Emit(Vector3 givePosition, Vector3 giveVelocity, float giveLifetime)
		
Emits a single particle with specified lifetime. This will set particle color from previously called emission (as set in the Source tab).

Parameters
givePosition	Position.
giveVelocity	Velocity.
giveLifetime	Lifetime.


int ParticlePlayground.PlaygroundParticlesC.Emit(
ector3 givePosition,
Vector3 	giveVelocity,
float 		giveLifetime,
Color32 	giveColor 
)	
	
Emits a single particle with specified position, velocity, lifetime and color.

Parameters
givePosition	Position.
giveVelocity	Velocity.
giveLifetime	Lifetime.
giveColor	Color.

To make a Particle Playground system emit particles manually from script, where you for example determine the position, velocity, lifetime and color can be done like this:

using UnityEngine;
using System.Collections;
using ParticlePlayground;

public class EmitExample : MonoBehaviour {
    IEnumerator Start () {
        PlaygroundParticlesC particles = GetComponent<PlaygroundParticlesC>();
        Vector3 position = Vector3.zero;
        Vector3 velocity = Vector3.up;
        float lifetime = 10f;
        Color32 color = Color.white;

        while (!particles.IsReady())
            yield return null;

        particles.Emit (position, velocity, lifetime, color);
    }
}

How Particle Playground 3 uses threads

Every particle system runs on multithreaded calls to relieve the main-thread where MonoBehaviour runs. Some functions will create yet another thread for performance, such as when updating chunks for the Particle Cache, calculating positions for Skinned World Objects and running the turbulence algorithms.

Certain functions in the Playground can’t run on a second thread due to the non thread-safe Physics class. This affects all methods relying on Raycasting such as collisions, painting and projections. Your particle system will still be calculated on a second thread but leave the non thread-safe calculations to run alongside a particle system’s Update loop. Every thread causes a small amount of memory garbage which will need to be collected at some point.

Using threads yourself

The threading solution is very simple and you can make use of the Playground’s multithreading by wrapping your own code in a lambda expression to PlaygroundC.RunAsync(), such as:

PlaygroundC.RunAsync(()=>{ // My demanding calculations here });

Note that you need to work with thread-safe classes in Unity to send data to another thread.

 

pp

popers

vinette4

Cursor_232

Overview: App targeted for mobile – geo-rotated – 3d rendering.

Option for camera pass through

Option for Marker Located AR – Card Demo

 

User1

jpjpgjp2

etchings