Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using ParticlePlayground;
- /// <summary>
- /// Move all particles in a particle system. Enable multithreading to run the translation asynchronously on another thread.
- /// </summary>
- [ExecuteInEditMode()]
- public class TranslateParticles : MonoBehaviour {
- public PlaygroundParticlesC particles;
- public Vector3 translation;
- public bool multithreading;
- void Update () {
- if (particles==null) return;
- if (multithreading) {
- PlaygroundC.RunAsync(()=>{
- Translate();
- });
- } else Translate();
- }
- void Translate () {
- for (int i = 0; i<particles.particleCount; i++)
- particles.Translate (i, translation*PlaygroundC.globalDeltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement