Skip to content

Instantly share code, notes, and snippets.

@attolee
Created January 25, 2019 09:01
Show Gist options
  • Save attolee/a0dc568d8dc07a3e91341715cdd391d9 to your computer and use it in GitHub Desktop.
Save attolee/a0dc568d8dc07a3e91341715cdd391d9 to your computer and use it in GitHub Desktop.
using UnityEngine;
public static class VectorExtensions
{
/// <summary>
/// 将坐标点移动四分之一个圆
/// </summary>
/// <param name="pivot">原点</param>
/// <param name="before">移动前的坐标点</param>
/// <returns>移动后的坐标点</returns>
public static Vector3 MoveMinusQuarterCircle(Vector3 pivot, Vector3 before)
{
var beforeVec = before - pivot;
var afterVec = beforeVec;
afterVec.x = -beforeVec.z;
afterVec.z = beforeVec.x;
return afterVec + pivot;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment