// -------------------------------------------------------------------------------------------- protected void Awake() { m_Transform = transform; m_NextStartPos = m_Transform.position + new Vector3(0, 0.1f, 0); Quaternion ninety = Quaternion.Euler(0, 90, 0); Quaternion negNinety = Quaternion.Euler(0, -90, 0); Quaternion twoSeventy = Quaternion.Euler(0, 270, 0); Quaternion negTwoSeventy = Quaternion.Euler(0, -270, 0); Zebug.Log($"90: {ninety}"); Zebug.Log($"-90: {negNinety}"); Zebug.Log($"270: {twoSeventy}"); Zebug.Log($"-270: {negTwoSeventy}"); Zebug.Log($"90inv: {Quaternion.Inverse(Quaternion.Euler(0,90, 0))}"); Zebug.Log($"-90inv: {Quaternion.Inverse(negNinety)}"); Zebug.Log($"270inv: {Quaternion.Inverse(twoSeventy)}"); Zebug.Log($"-270inv: {Quaternion.Inverse(negTwoSeventy)}"); Quaternion mightBeShort = Quaternion.Slerp(Quaternion.identity, negTwoSeventy, 1f); Zebug.Log($"shortPath(-270) = {mightBeShort}"); Zebug.Log($"90: {ninety}"); }
// -------------------------------------------------------------------------------------------- protected void Update() { Vector3 transformPos = m_Transform.position; Vector3 pos = transformPos; Vector3 offset = new Vector3((float)Math.Sin(6.28f * Time.time) , 0 , (float)Math.Cos(6.28f * Time.time)); Zebug.DrawLine(pos, pos + offset); Vector3 pp = m_NextStartPos; float inc = Time.deltaTime * 0.01f; if ((int)(Time.time / 20f) % 2 == 1) { inc = -inc; } m_PhiRange += inc; m_RadiusPhiRange += inc; m_ThetaInc += inc; Vector3 lastPos = pp; for (float i = m_LastStart; i < m_LastStart + m_Range; i += m_Step) { float phi = m_PhiBase * Mathf.PerlinNoise(i * 0.05f, m_PhiRange); float theta = m_ThetaBase * Mathf.PerlinNoise(i * 0.02f, 0f) * m_ThetaInc; float radius = m_Radius + m_Radius * Mathf.PerlinNoise(i * 0.05f, m_RadiusPhiRange); pp = AddSpherical(pp, radius, theta, phi); pp *= 0.87f; Zebug.DrawLine(lastPos, pp); lastPos = pp; if (i < m_LastStart + m_Speed) { m_NextStartPos = lastPos; } } if (Time.time > m_LastBurstTime + m_BurstDuration) { Zebug.DrawBurst(new Vector3(-2, 2, -2), 0.25f, new Color(1f, 1f, 0f) * 0.8f, 0.5f * m_BurstDuration); m_LastBurstTime = Time.time; } Zebug.DrawBox(new Vector3(2f, 2f, 2f), Quaternion.identity, new Vector3(1, 1, 2)); Zebug.DrawLocator(new Vector3(0, 0, 0)); m_LastStart += m_Speed; }
protected static void InitializeOnLoad() { if (s_Instance != null) { return; } var go = new GameObject("ZebugSceneDrawer Helper GO"); s_Instance = go.AddComponent <ZebugSceneDrawer>(); //go.hideFlags = HideFlags.HideAndDontSave; DontDestroyOnLoad(go); Zebug.Log("Initializing Scene Drawer"); }