public void SetParentTransform(ParticleTransform parentTransform) { var notNull = (parentTransform != null); var ownScale = Scale * ScaleUniform; WorldScale = (notNull && InheritScale) ? ownScale * parentTransform.WorldScale.X : ownScale; WorldRotation = (notNull && InheritRotation) ? Rotation * parentTransform.WorldRotation : Rotation; var offsetTranslation = Position * ((notNull && InheritScale) ? parentTransform.WorldScale.X : 1f); if (notNull && InheritRotation) { parentTransform.WorldRotation.Rotate(ref offsetTranslation); } WorldPosition = (notNull && InheritPosition) ? parentTransform.WorldPosition + offsetTranslation : offsetTranslation; }
/// <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="transform"><see cref="ParticleSystem"/>'s transform (from the Transform component) or identity if local space is used</param> /// <param name="parent">The parent <see cref="ParticleSystem"/></param> public virtual void SetParentTRS(ParticleTransform transform, ParticleSystem parent) { SetParentTransform(transform); }