Ray front_ray_car_left = new Ray(frontLidar.position, frontLidar.forward * Quaternion.Euler(0, -45f, 0));
此句代码报错:
Operator `*' cannot be applied to operands of type `UnityEngine.Vector3' and `UnityEngine.Quaternion'
经过查手册发现,是因为Vector3类型没有与Quaternion类型有运算符*的重载,而Quaternion类有与Vector3的*重载
所以将代码改为
Ray front_ray_car_left = new Ray(frontLidar.position, Quaternion.Euler(0, -45f, 0) * frontLidar.forward);
就可以通过编译了。