I cant figure out how to make my particles move with velocity.
tried a few things but none worked. and i dont understand the function get particles.
thank you for your time
using UnityEngine;
using System.Collections;
public class SunPhotons : MonoBehaviour {
public int InitSpeed=75;
int j=0;
public int NumberOfParticles=100;
private ParticleSystem.Particle[] Photons;
private ParticleSystem.Particle[] Photons2;
bool isInitializedPosition=false;
Vector3 LocationForDebug = new Vector3(0,0,0);
Vector3 SpeedForDebug = new Vector3 (10,10,10);
void Start () {
Photons = new ParticleSystem.Particle[NumberOfParticles];
}
// Update is called once per frame
void LateUpdate () {
int i;
ParticleSystem SunRay = GameObject.Find("SunRay").GetComponent<ParticleSystem>();
for ( i = 0; i < NumberOfParticles; i++)
{
if (!isInitializedPosition)
{
Photons*.position=LocationForDebug;*
_ Photons*.color=new Color(10,0,0);_
_ Photons.startLifetime=2;
Photons.lifetime=4;
Photons.size=0.2f;*_
* }*
_ Photons*.velocity=SpeedForDebug;
Photons.angularVelocity=0.4f;*_
_ // Photons*.position= new Vector3((i+j)/100f,0,0);
particleSystem.SetParticles(Photons,NumberOfParticles);*_
* }*
* particleSystem.SetParticles(Photons,NumberOfParticles);*
* j++;*
* GameObject.Find(“SunRay”).GetComponent().GetParticles(Photons2);*
* isInitializedPosition=true;*
* }*
}