Pathfinding.RVO.Sampled.Agent.DrawCircle C# (CSharp) Method

DrawCircle() static private method

static private DrawCircle ( Vector2 _p, float radius, float a0, float a1, Color col ) : void
_p UnityEngine.Vector2
radius float
a0 float
a1 float
col UnityEngine.Color
return void
		static void DrawCircle (Vector2 _p, float radius, float a0, float a1, Color col) {
			Vector3 p = To3D(_p);

			while (a0 > a1) a0 -= 2*Mathf.PI;

			Vector3 prev = new Vector3(Mathf.Cos(a0)*radius, 0, Mathf.Sin(a0)*radius);
			const float steps = 40.0f;
			for (int i = 0; i <= steps; i++) {
				Vector3 c = new Vector3(Mathf.Cos(Mathf.Lerp(a0, a1, i/steps))*radius, 0, Mathf.Sin(Mathf.Lerp(a0, a1, i/steps))*radius);
				Debug.DrawLine(p+prev, p+c, col);
				prev = c;
			}
		}

Same methods

Agent::DrawCircle ( Vector2 _p, float radius, Color col ) : void

Usage Example

Example #1
0
        private static void DrawVO(Vector2 circleCenter, float radius, Vector2 origin)
        {
            float num  = Mathf.Atan2((origin - circleCenter).y, (origin - circleCenter).x);
            float num2 = radius / (origin - circleCenter).magnitude;
            float num3 = (num2 > 1f) ? 0f : Mathf.Abs(Mathf.Acos(num2));

            Agent.DrawCircle(circleCenter, radius, num - num3, num + num3, Color.black);
            Vector2 vector  = new Vector2(Mathf.Cos(num - num3), Mathf.Sin(num - num3)) * radius;
            Vector2 vector2 = new Vector2(Mathf.Cos(num + num3), Mathf.Sin(num + num3)) * radius;
            Vector2 p       = -new Vector2(-vector.y, vector.x);
            Vector2 p2      = new Vector2(-vector2.y, vector2.x);

            vector  += circleCenter;
            vector2 += circleCenter;
            Debug.DrawRay(Agent.To3D(vector), Agent.To3D(p).normalized * 100f, Color.black);
            Debug.DrawRay(Agent.To3D(vector2), Agent.To3D(p2).normalized * 100f, Color.black);
        }
All Usage Examples Of Pathfinding.RVO.Sampled.Agent::DrawCircle