public void TravelAlongArc() { if (ArcAngle == 360) { ArcAngle = director.TakeAngle(); } Vector3 midpoint = (transform.position + playerT.transform.position) / 2f; float x = midpoint.x + (transform.position.x - midpoint.x) * Mathf.Cos(ArcAngle) - (transform.position.z - midpoint.z) * Mathf.Sin(ArcAngle); float z = midpoint.z + (transform.position.x - midpoint.x) * Mathf.Sin(ArcAngle) + (transform.position.z - midpoint.z) * Mathf.Cos(ArcAngle); //float x = playerT.position.x + (transform.position.x - playerT.position.x) * Mathf.Cos(ArcAngle) - (transform.position.z - playerT.position.z) * Mathf.Sin(ArcAngle); //float z = playerT.position.z + (transform.position.x - playerT.position.x) * Mathf.Sin(ArcAngle) + (transform.position.z - playerT.position.z) * Mathf.Cos(ArcAngle); //do angle side angle calculation from the distance to player //test changing cube positions, or we should add ray trace lines ArcTarget = new Vector3(x, transform.position.y, z); Debug.DrawLine(transform.position, ArcTarget); if (GetEnemyMovementCtrl.GetRemainingDistance() < 3) { GetEnemyMovementCtrl.SetDestination(playerT.position); } else { GetEnemyMovementCtrl.SetDestination(ArcTarget); } GetEnemyMovementCtrl.ResumeMovement(); }