📜  unity c# Flip sprite - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:10.207000             🧑  作者: Mango

代码示例1
public Camera cam;
   public Transform aimTransform;



Vector3 mousePosition = cam.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y));
        Vector3 aimDirection = (mousePosition - transform.position).normalized;
        float angle = Mathf.Atan2(aimDirection.y, aimDirection.x) * Mathf.Rad2Deg;
        aimTransform.eulerAngles = new Vector3(0, 0, angle);