示例#1
0
        // 判断target是否在以source为中心的朝向为facing的角度范围fov_deg里面
        public static bool InsideFov(ref Vector2I source, ref Vector2I facing, int fov_deg, ref Vector2I target)
        {
            Vector2I to_target = target - source;

            to_target.Normalize();
            return(to_target.Dot(ref facing) >= IntMath.CosI(fov_deg / 2));
        }
示例#2
0
 public void FromDegree(int degree)
 {
     //ZZWTODO 和美术资源的默认朝向相关
     x = IntMath.CosI(degree);
     z = IntMath.SinI(degree);
     Normalize();
 }