Im trying to create a little game with a space ship and encountered a small problem with trail of space ship engine.
I’ve created a particle and wrote a small script which increase start lifetime and size of particles to produce visual effect of ship speed increasing.
But, when my ship rotates I want to show that trail of ship rotates slowly also (currently my trail always looks like straight line and i want to modify it so it will look like curve when my ship rotates).
So, I have several variables from my “movement script”: speed of ship, vector to target and angel between ship and target.
After using google I found a way to change velocity of particle with the help of next code:
public void UpdateDirection()
{
float distance = 5;
ParticleSystem.Particle[] particles = new ParticleSystem.Particle[particle.particleCount];
int count = particle.GetParticles(particles);
for(int i = 0; i < count; i++)
{
float xVel = (particles<em>.lifetime / particles_.startLifetime) * distance;_</em>
particles*.velocity = new Vector3(xVel, 0, 0.2f);*
*} *
particle.SetParticles(particles, count);
}
I’ve tried several diff. ways of modifying velocity with my vector.x coordinate, angel and etc, but after this my particle worked very strange way, like without any lifetime, or just bursting in left or right side.
How can I use my data to modify velocity and move from straight line to curve trail? Pls help
EDIT: Excuse me to bringing back this question, but after sometime I realised that simulation space isnt helping me with that problem. Currently it rotates right at the emit point and this is bad, because it looks ugly. I need some way of applying force to particle after sometime, like script option of “force over lifetime” (I cant use this direct from unity editor, because rotating is random)