private void Update() { if (jointAndPointControlls == null) { return; } if (delayTime - Time.deltaTime > 0) { delayTime -= Time.deltaTime; return; } else if ((delayTime > 0 && delayTime - Time.deltaTime < 0) || isResetPoint) { delayTime -= Time.deltaTime; RestorePoint(); return; } if (isResetPoint) { RestorePoint(); isResetPoint = false; return; } deltaTime = Mathf.Min(Time.deltaTime, 0.016f); scale = transform.lossyScale.x / initializeScale; windForce = ADBWindZone.getWindForce(transform.position, deltaTime * windScale) * windScale; UpdateDataPakage(); }
public static Vector3 getaddForceForce(Vector3 position) { if (windZone == null) { windZone = new ADBWindZone(); } windZone.time = Time.time; windZone.randomVec += Random.insideUnitSphere * granularity; windZone.randomVec.y = 0; windZone.randomVec.Normalize(); return(windZone.randomVec.normalized * (Mathf.Sin(windZone.time + position.magnitude) * 0.25f + 0.25f)); }
public static Vector3 getWindForce(Vector3 position, float deltaTime) { if (deltaTime == 0) { return(Vector3.zero); } if (windZone == null) { windZone = new ADBWindZone(); } windZone.time += deltaTime; windZone.randomVec += Random.insideUnitSphere * deltaTime; windZone.randomVec.y = 0; windZone.randomVec.Normalize(); return(windZone.randomVec * Mathf.PerlinNoise(position.x + windZone.time, position.y + windZone.time) * 0.2f); }