unity---3D数学基础
点乘

A·B

判断敌人在前方还是后方
调试画线
画线段 前两个参数 分别是 起点 终点
画射线 前两个参数 分别是 起点 方向
Debug.DrawLine(this.transform.position,this.transform.position+ this.transform.forward,Color.red);
Debug.DrawRay(this.transform.position,this.transform.forward*100,Color.white);
计算点乘
利用自带的计算函数



通过点乘推导公式算出夹角

练习
计算当敌人距离小于5,并且角度小于22.5

叉积


判断物体在右侧还是左侧

作业




浙公网安备 33010602011771号