I drew an arc between 2 gameobjects . Now I want to see direction of arc so I want to draw an arrow How can I do this? Code is here:
using UnityEngine;
using System.Collections;
public class Line : MonoBehaviour
{
public Transform p0Transform, p1Transform;
void OnDrawGizmos()
{
if (p0Transform == null || p1Transform == null)
return;
Vector3 p0 = p0Transform.position;
Vector3 p1 = p1Transform.position;
Vector3 center = new Vector3(p0.x, 0f, p1.z);
float radiusX = p0.x - p1.x;
float radiusZ = p0.z - p1.z;
Gizmos.color = Color.cyan;
int segmentCount = 5;
float angleInterval = (1f / segmentCount) * (Mathf.PI * 0.5f);
for (int i = 0; i < segmentCount; i++)
{
float angle = ((float)i / segmentCount) * (Mathf.PI * 0.5f) + Mathf.PI * 0.5f;
float nextAngle = angle + angleInterval;
Vector3 lineStartPos = center + new Vector3(Mathf.Cos(angle) * radiusX, 0f, Mathf.Sin(angle) * radiusZ);
Vector3 lineEndPos = center + new Vector3(Mathf.Cos(nextAngle) * radiusX, 0f, Mathf.Sin(nextAngle) * radiusZ);
Gizmos.DrawLine(lineStartPos, lineEndPos);
}
}
}