假定物体初始水平
private float GetAngle(Vector3 startPos, Vector3 endPos)
{
Vector3 dir = endPos - startPos;
float angle = Vector3.Angle(Vector3.right, dir);
Vector3 cross = Vector3.Cross(Vector3.right, dir);
float dirF = cross.z > 0 ? 1 : -1;
angle = angle * dirF;
return angle;
}