IEnumerator FromToShape(float smoothTime) { OrbitalCamera.Refocus = true; for (int i = 0; i < _shapes.Length; i++) { PreSmoothSwitch(i); } for (float t = 0; t <= smoothTime; t += Time.deltaTime) { float t1 = t / smoothTime; for (int i = 0; i < _shapes.Length; i++) { _currentShapes[i].n1 = MathfMore.SmootherStep(_shapes[i].n1, _nextShapes[i].n1, t1); _currentShapes[i].n2 = MathfMore.SmootherStep(_shapes[i].n2, _nextShapes[i].n2, t1); _currentShapes[i].n3 = MathfMore.SmootherStep(_shapes[i].n3, _nextShapes[i].n3, t1); _currentShapes[i].m1 = MathfMore.SmootherStep(_shapes[i].m1, _nextShapes[i].m1, t1); _currentShapes[i].m2 = MathfMore.SmootherStep(_shapes[i].m2, _nextShapes[i].m2, t1); } Shapes.UpdateSuperVolume(ref _shapeMesh, _radius, _currentShapes[0], _currentShapes[1], _lonRes, _latRes); _meshFilter.mesh = _shapeMesh; yield return(new WaitForEndOfFrame()); } OrbitalCamera.Refocus = false; }
private static Matrix4x4 SmoothestStepMatrix(Matrix4x4 pSrc, Matrix4x4 pDst, float pSmoothTime) { Matrix4x4 ret = new Matrix4x4(); for (int i = 0; i < 16; i++) { ret[i] = MathfMore.SmoothestStep(pSrc[i], pDst[i], pSmoothTime); } return(ret); }
private static Vector3 SmoothestStepV3(Vector3 pStart, Vector3 pEnd, float pSmoothTime) { Vector3 ret = new Vector3(); for (int i = 0; i < 3; i++) { ret.x = MathfMore.SmoothestStep(pStart.x, pEnd.x, pSmoothTime); ret.y = MathfMore.SmoothestStep(pStart.y, pEnd.y, pSmoothTime); ret.z = MathfMore.SmoothestStep(pStart.z, pEnd.z, pSmoothTime); } return(ret); }
IEnumerator SmoothZoom(Vector3 form, Vector3 to) { _zooming = true; float smoothTime = 0.1f; Vector3 interPos = new Vector3(); for (float t = 0; t <= smoothTime; t += Time.deltaTime) { float t1 = t / smoothTime; interPos.x = MathfMore.SmootherStep(form.x, to.x, t1); interPos.y = MathfMore.SmootherStep(form.y, to.y, t1); interPos.z = MathfMore.SmootherStep(form.z, to.z, t1); this.transform.position = interPos; yield return(new WaitForEndOfFrame()); } _zooming = false; }