public static void AffectedBrownian(object value) { AffectedParticle particle = value as AffectedParticle; Transform transform = particle.transform; Vector3 previousPosition = transform.position; ((Action <Particle>)Particle.Brownian).Invoke(particle); Vector3 position = transform.position; Vector3 targetPosition = previousPosition + AggregateAffectors(position, particle.affectors); position = Vector3.Lerp(position, targetPosition, particle.effectStrength); transform.position = position; }
public static void AffectedBrownianTest(object value) { AffectedParticle particle = value as AffectedParticle; ((Action <Particle>)Particle.Brownian).Invoke(particle); // float tLength = 4; float a = Time.time; Vector3 targetPosition = new Vector3( Mathf.Cos(a) * tLength, Mathf.Sin(a) * tLength, Mathf.Cos(a) * tLength ); Transform transform = particle.transform; Vector3 position = transform.position; position = Vector3.Lerp(position, targetPosition, particle.effectStrength); transform.position = position; }