Unity 2d 不基于射线检测使鼠标改变物体方向
void Rotate()
{
Vector3 mousePoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mousePoint.z = transform.position.z;
Vector3 dir = (mousePoint - transform.position).normalized;
transform.up = dir;
}
PS:
然后在Update方法中调用。
版权声明:
作者:lichengxin
链接:https://www.techfm.club/p/26303.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。
THE END
二维码
共有 0 条评论