- Home /
Changing startRotation from ParticleSystem on script does not work
Hello!
I am spawning "meteor" objects in my game, they have a tail formed by a ParticleSystem. However, the particles must be orientated in a specific direction, hence, I try to set
meteor.GetComponent<ParticleSystem>().startRotation = myRotation;
on script, so that every created particle is on the direction I need. However, the value that I see updated on the Live Editor does not match with what I input (even when % 360).
When I try printing that value by script after setting it, it prints out correctly. But when I check that value on the live editor, it is completely different. If I change that value on the Live Editor to the one I want and ask it to simulate my particles, everything works greatly and my particles appear in the correct orientation.
What can be happening here? Is the startParticle be somehow changed after I set it? Should I change it through any other means but manipulating it directly?
Thanks in advance. Fernando.
I have the exact same problem. For example, when I programmatically set startRotation to 23.5898, it is actually changed to 1351.596 in game. Did you ever figure this out?
23.5898 and 1351.596 are the same value in radians and degress. so search into which measure units used in methods you use.
Answer by tenfour04 · Aug 26, 2012 at 12:51 AM
I discovered that when you set the value in code, you should enter your desired value in radians. It is converted to degrees before it is displayed in the inspector. When you enter it in the inspector, just use degrees.