- Home /
Question by
Deathtreak · Jan 31, 2019 at 08:34 PM ·
c#rotationquaternionanglesspawning problems
Random direction between maxAngle and minAangle , Quaternion issue....
Hi everybody, Hope someone can help me, i'm stuck with quaternion. So my problem is :
I want to spawn particles around my emitter between two angle
Quaternion max = Quaternion.Euler(0.0f, 0.0f, _maxAngle);
Quaternion min = Quaternion.Euler(0.0f, 0.0f, -_maxAngle);
Vector3 maxVector = max * transform.up;
Vector3 minVector = min * transform.up;
Vector3 result = Vector3.Lerp(minVector, maxVector, Random.value);
float particleSpeed = Random.Range(_particleSpeedMin, _particleSpeedMax);
Vector3 speed = result * particleSpeed;
So if "_maxAngle" is equal to 30 particles spawn on a cone of 60° (between -30 and 30)
But
My problem is, if "_maxAngle" is equal to 180 so particles spawn in a straight line and not all around my emitter, i noticed that "maxVector" and "minVector" as the same value : (0,-1,0), but i don't know how to manage the problem
Thanks for your attention and hope i can read you soon
Comment