// Magica Cloth. // Copyright (c) MagicaSoft, 2020-2022. // https://magicasoft.jp using Unity.Mathematics; using UnityEngine; namespace MagicaCloth { /// /// WindComponent API /// public abstract partial class WindComponent : BaseComponent { /// /// 風量 /// Air flow. /// public float Main { get => main; set { main = Mathf.Clamp(value, 0.0f, Define.Compute.MaxWindMain); status.SetDirty(); } } /// /// 乱流率 /// Turbulence rate.(0.0 - 1.0) /// public float Turbulence { get => turbulence; set { turbulence = Mathf.Clamp01(value); status.SetDirty(); } } /// /// 周波数 /// Frequency rate.(0.0 - 1.0) /// public float Frequency { get => frequency; set { frequency = Mathf.Clamp01(value); status.SetDirty(); } } /// /// 基準となる風向き(ワールド) /// Wind world direction. /// public Vector3 MainDirection { get => transform.TransformDirection(GetLocalDirection()); set { var lv = transform.InverseTransformDirection(value); directionAngleX = Mathf.Atan2(lv.z, lv.x) * Mathf.Rad2Deg; directionAngleY = Mathf.Atan2(lv.z, lv.y) * Mathf.Rad2Deg; status.SetDirty(); } } /// /// 風向きのX軸角度(Degree) /// Wind direction X-axis angle (Degree) /// public float DirectionAngleX { get => directionAngleX; set { directionAngleX = value; status.SetDirty(); } } /// /// 風向きのY軸角度(Degree) /// Wind direction Y-axis angle (Degree). /// public float DirectionAngleY { get => directionAngleY; set { directionAngleY = value; status.SetDirty(); } } /// /// 風エリアのサイズ /// Wind area size. /// public Vector3 AreaSize { get => areaSize; set { areaSize = math.max(value, 0.1f); status.SetDirty(); } } /// /// 風エリアの半径 /// Wind area radius. /// public float AreaRadius { get => areaRadius; set { areaRadius = math.max(value, 0.1f); status.SetDirty(); } } /// /// 風の方向性 /// Wind direction type. /// public PhysicsManagerWindData.DirectionType DirectionType { get => directionType; set { directionType = value; status.SetDirty(); } } /// /// 球形エリアの減衰率 /// Damping factor of spherical area. /// /// Influence rate of start point.(0.0 - 1.0) /// Influence rate of end point.(0.0 - 1.0) /// Validity of endpoint value /// Strength of the curve.(-1.0 - +1.0) /// Validity of curve value public void SetAttenuation(float sval, float eval, bool useEval = true, float cval = 0.0f, bool useCval = false) { attenuation.SetParam(sval, eval, useEval, cval, useCval); status.SetDirty(); } } }