还原水插件
This commit is contained in:
@@ -18,9 +18,6 @@ namespace WaveHarmonic.Crest.Examples
|
||||
int _Version = 0;
|
||||
#pragma warning restore 414
|
||||
|
||||
[SerializeField]
|
||||
bool _WorldSpace;
|
||||
|
||||
[Header("Translation")]
|
||||
|
||||
[SerializeField]
|
||||
@@ -55,7 +52,7 @@ namespace WaveHarmonic.Crest.Examples
|
||||
|
||||
void Start()
|
||||
{
|
||||
_Origin = _WorldSpace ? transform.position : transform.localPosition;
|
||||
_Origin = transform.position;
|
||||
|
||||
_OrthogonalAxis = Quaternion.AngleAxis(90f, Vector3.up) * _Axis;
|
||||
}
|
||||
@@ -67,21 +64,10 @@ namespace WaveHarmonic.Crest.Examples
|
||||
// Do circles in perlin noise
|
||||
var rnd = 2f * (Mathf.PerlinNoise(0.5f + 0.5f * Mathf.Cos(_Frequency * Time.time), 0.5f + 0.5f * Mathf.Sin(_Frequency * Time.time)) - 0.5f);
|
||||
|
||||
// Prevent jump at start.
|
||||
var amplitude = Mathf.Min(_Amplitude, _Amplitude * Time.timeSinceLevelLoad);
|
||||
|
||||
var orthoPhaseOff = Mathf.PI / 2f;
|
||||
var rndOrtho = 2f * (Mathf.PerlinNoise(0.5f + 0.5f * Mathf.Cos(_Frequency * Time.time + orthoPhaseOff), 0.5f + 0.5f * Mathf.Sin(_Frequency * Time.time + orthoPhaseOff)) - 0.5f);
|
||||
var position = _Origin + (_Axis * rnd + _OrthogonalMotion * rndOrtho * _OrthogonalAxis) * amplitude;
|
||||
|
||||
if (_WorldSpace)
|
||||
{
|
||||
transform.position = position;
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.localPosition = position;
|
||||
}
|
||||
transform.position = _Origin + (_Axis * rnd + _OrthogonalMotion * rndOrtho * _OrthogonalAxis) * _Amplitude;
|
||||
}
|
||||
|
||||
// Rotation
|
||||
|
||||
Reference in New Issue
Block a user