
上QQ阅读APP看书,第一时间看更新
Adapt for object heights and opaque obstacles
This radar script scans 360 degrees all around the player, and only considers straight line distances in the X-Z plane. So, the distances in this radar are not affected by any height difference between the player and target GameObjects. The script can be adapted to ignore targets whose height is more than some threshold different to the player's height.
Also, as presented, this recipe radar sees through everything, even if there are obstacles between the player and the target. The recipe can be extended to not show obscured targets through the use of the Ray Casting techniques. See the Unity scripting reference for more details about ray-casting: http://docs.unity3d.com/ScriptReference/Physics.Raycast.html.