public override void SetParentTrs(ref Vector3 Translation, ref Quaternion Rotation, float Scale)
        {
            base.SetParentTrs(ref Translation, ref Rotation, Scale);

            var hasScl = InheritLocation.HasFlag(InheritLocation.Scale);

            parentScale = (hasScl) ? Scale : 1f;
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the parent (particle system's) translation, rotation and scale (uniform)
        /// The module can choose to inherit, use or ignore any of the elements
        /// </summary>
        /// <param name="translation">Particle System's translation (from the Transform component)</param>
        /// <param name="rotation">Particle System's quaternion rotation (from the Transform component)</param>
        /// <param name="scale">Particle System's uniform scale (from the Transform component)</param>
        public virtual void SetParentTrs(ref Vector3 translation, ref Quaternion rotation, float scale)
        {
            var hasPos = InheritLocation.HasFlag(InheritLocation.Position);
            var hasRot = InheritLocation.HasFlag(InheritLocation.Rotation);
            var hasScl = InheritLocation.HasFlag(InheritLocation.Scale);

            WorldScale = (hasScl) ? ParticleLocator.Scale * scale : ParticleLocator.Scale;

            WorldRotation = (hasRot) ? ParticleLocator.Rotation * rotation : ParticleLocator.Rotation;

            var offsetTranslation = ParticleLocator.Translation * WorldScale;

            WorldRotation.Rotate(ref offsetTranslation);
            WorldPosition = (hasPos) ? translation + offsetTranslation : offsetTranslation;
        }