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

DrawVO() static private method

static private DrawVO ( Vector2 circleCenter, float radius, Vector2 origin ) : void
circleCenter UnityEngine.Vector2
radius float
origin UnityEngine.Vector2
return void
		static void DrawVO (Vector2 circleCenter, float radius, Vector2 origin) {
			float alpha = Mathf.Atan2((origin - circleCenter).y, (origin - circleCenter).x);
			float gamma = radius/(origin-circleCenter).magnitude;
			float delta = gamma <= 1.0f ? Mathf.Abs(Mathf.Acos(gamma)) : 0;

			DrawCircle(circleCenter, radius, alpha-delta, alpha+delta, Color.black);
			Vector2 p1 = new Vector2(Mathf.Cos(alpha-delta), Mathf.Sin(alpha-delta)) * radius;
			Vector2 p2 = new Vector2(Mathf.Cos(alpha+delta), Mathf.Sin(alpha+delta)) * radius;

			Vector2 p1t = -new Vector2(-p1.y, p1.x);
			Vector2 p2t = new Vector2(-p2.y, p2.x);
			p1 += circleCenter;
			p2 += circleCenter;

			Debug.DrawRay(To3D(p1), To3D(p1t).normalized*100, Color.black);
			Debug.DrawRay(To3D(p2), To3D(p2t).normalized*100, Color.black);
		}

Usage Example

Beispiel #1
0
        private void GenerateNeighbourAgentVOs(Agent.VOBuffer vos)
        {
            float   num = 1f / this.agentTimeHorizon;
            Vector2 a   = this.currentVelocity;

            for (int i = 0; i < this.neighbours.Count; i++)
            {
                Agent agent = this.neighbours[i];
                if (agent != this)
                {
                    float num2 = Math.Min(this.elevationCoordinate + this.height, agent.elevationCoordinate + agent.height);
                    float num3 = Math.Max(this.elevationCoordinate, agent.elevationCoordinate);
                    if (num2 - num3 >= 0f)
                    {
                        float   num4   = this.radius + agent.radius;
                        Vector2 vector = agent.position - this.position;
                        float   num5;
                        if (agent.locked || agent.manuallyControlled)
                        {
                            num5 = 1f;
                        }
                        else if (agent.Priority > 1E-05f || this.Priority > 1E-05f)
                        {
                            num5 = agent.Priority / (this.Priority + agent.Priority);
                        }
                        else
                        {
                            num5 = 0.5f;
                        }
                        Vector2 b       = Vector2.Lerp(agent.currentVelocity, agent.desiredVelocity, 2f * num5 - 1f);
                        Vector2 vector2 = Vector2.Lerp(a, b, num5);
                        vos.Add(new Agent.VO(vector, vector2, num4, num, 1f / this.simulator.DeltaTime));
                        if (this.DebugDraw)
                        {
                            Agent.DrawVO(this.position + vector * num + vector2, num4 * num, this.position + vector2);
                        }
                    }
                }
            }
        }
All Usage Examples Of Pathfinding.RVO.Sampled.Agent::DrawVO