- Home /
Rotate a particle emmiter
Hello,
I have a particle Emitter that emit particles on hit. Hierarchy is like that => PlayerGameObject ParticleEmitter
It looks like a cone like this that I would like to rotate all around based on where the hit come from :
In order to do that I have to modify this "shape" module of the particle
But I can't find any way to modify it from code, cause It always say it is not a variable, and I don't find a way to store it.
I then decided to modify directly the transform.
I would like to modify ONLY the X value cause it will make me able to turn 360degree around. But If I use euler angle, it also modify Z and Y.
How can I manage to do that ?
I tried that already
ParticleSystem.Shape$$anonymous$$odule.rotation = Quaternion.Euler(v.x, -Angle(dir), v.z);
give me "An Object reference is required for the non-static field, method, property " ParticleSystem.Shape$$anonymous$$odule.rotation"
So I tried with
myParticleSystem.shape.rotation = Quaternion.Euler(v.x, -Angle(dir), v.z);
And I have Cannot $$anonymous$$odify the return value of ParticleSystem.shape because it is not a variable
You can’t access a module’s property like that. Declare the module struct to a var first: var ps = GetComponent(); var ps_shape = ps.shape; ps_shape.rotation = Quaternion.Euler(v.x, -Angle(dir), v.z);
ref: https://blogs.unity3d.com/2016/04/20/particle-system-modules-faq/
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Laser beam using particle system Unity2d. 0 Answers
Rigidbody velocity angle. 1 Answer