/// 讓某物體轉角到鼠標點擊的位置
/// </summary>
/// <param name="RotateGO">需要轉角的那個物體</param>
public static void RotateToMouseClick(Transform RotateGO)
{
Vector3 mousePos = Input.mousePosition;
mousePos = Camera.main.ScreenToWorldPoint(mousePos);
Vector2 targetDir = mousePos - RotateGO.position;
float angle = Vector2.Angle(targetDir, Vector3.up);
if (mousePos.x > RotateGO.position.x)
angle = -angle;
RotateGO.eulerAngles = new Vector3(0, 0, angle);
}
某個點旋轉某個角度後延某個方向運動運動十米
Vector3 newPos = this.transform.rotation * new Vector3(10f, 0f, 0f);