if (Physics.Raycast(transform.position + Vector3.up, Dec , out hit , 1<< LayerMask.NameToLayer("Terrain") | 1 << LayerMask.NameToLayer("Player")))
{
if (hit.collider.name == "人物")
{
Vector3 v2 = Player.transform.InverseTransformPoint(transform.position);
if (v2.z > 0)
{
Vector3 v = playerEye.WorldToViewportPoint(transform.position);
if (v.x > 0 && v.x < 1f && v.y < 1 && v.y > 0)
{
isVisible = true;
}
else
{
isVisible = false;
}
}
else
{
isVisible = false;
}
}
else
{
isVisible = false;
}
}
unity 怎么判断凹凸不平地面 物体是否出现在视野之内
最新推荐文章于 2024-06-25 17:53:10 发布