- Home /
Question by
Kennyist · Mar 12, 2018 at 11:27 AM ·
gameobjecttransformparticlesparticlesystemparticle emitter
Particles wont rotate with system or parent
I have a particle system with particles that are created via script:
void PopulateStarsSeed()
{
Debug.Log("star seed");
UnityEngine.Random.InitState(starSeed);
ParticleSystem.Particle[] points = new ParticleSystem.Particle[maxParticals];
particals.GetParticles(points);
for (int i = 0; i < maxParticals; i++)
{
points[i].position = UnityEngine.Random.insideUnitSphere * maxStarDistance;
points[i].startSize = UnityEngine.Random.Range(minStarSize, maxStarSize);
points[i].startColor = Color.white;
points[i].axisOfRotation = starContainer.transform.position;
points[i].startLifetime = Mathf.Infinity;
points[i].remainingLifetime = Mathf.Infinity;
}
particals.SetParticles(points, points.Length);
}
These show up fine in game but they will not rotate with the game object or parent, The system is set to Local Space and the renderer:
Spawning a default system and rotating it works fine, Just cannot get this system to work.
untitled.png
(55.6 kB)
Comment
Answer by ifurkend · Mar 12, 2018 at 12:25 PM
Depending on which version of Unity you are working on, but I guess axisOfRotation is already obsolete and you can instead use “rotation”.
https://docs.unity3d.com/ScriptReference/ParticleSystem.Particle.html