Hi,
I have the below code, which is expected to set rotation of my particles at runtime.
void ChangeParticleRotation()
{
//Tilting rain as per wind direction
var rotationOverLifetimeModule = rainParticleSystem.rotationOverLifetime;
ParticleSystem.MinMaxCurve minMaxCurveZ = new ParticleSystem.MinMaxCurve();
minMaxCurveZ.mode = ParticleSystemCurveMode.Constant;
minMaxCurveZ.constant = Mathf.Sign(oceanController.windDirection.z) * 45;
rotationOverLifetimeModule.z = minMaxCurveZ;
Debug.Log(rotationOverLifetimeModule.z.constant + "," + oceanController.windDirection.z + "," + Mathf.Sign(oceanController.windDirection.z));
}
The debug line returns the below results
45,0.9824775,1
UnityEngine.Debug:Log(Object)
SkyManager:ChangeParticleRotation() (at Assets/Scripts/SkyManager.cs:104)
SkyManager:Update() (at Assets/Scripts/SkyManager.cs:39)
But in the particles, i can see the value for Z set as below! (Z = 2578.31)
Can someone explain what is happening here. What am I doing wrong?
Your inputs are much appreciated.
Thanks,
Joshua.