mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
customizable noise
This commit is contained in:
parent
e9081c468c
commit
c957500710
@ -66,6 +66,9 @@ public void Awake()
|
||||
void OnEnable() { wrap.enabled = true; }
|
||||
void OnDisable() { wrap.enabled = false; }
|
||||
|
||||
// noise function can be replaced if needed
|
||||
protected virtual float Noise(float time) => Mathf.PerlinNoise(time, time);
|
||||
|
||||
// helper function to simulate latency
|
||||
float SimulateLatency(int channeldId)
|
||||
{
|
||||
@ -73,8 +76,7 @@ float SimulateLatency(int channeldId)
|
||||
// no spikes isn't realistic.
|
||||
// sin is too predictable / no realistic.
|
||||
// perlin is still deterministic and random enough.
|
||||
float sample = Time.time * latencySpikeSpeedMultiplier;
|
||||
float spike = Mathf.PerlinNoise(sample, sample) * latencySpikeMultiplier;
|
||||
float spike = Noise(Time.time * latencySpikeSpeedMultiplier) * latencySpikeMultiplier;
|
||||
|
||||
// base latency
|
||||
switch (channeldId)
|
||||
|
Loading…
Reference in New Issue
Block a user