1. Raycast 没有效果
通过collider的射线收集碰撞体,没有效果,不知道为什么?
Ray ray = new Ray {
origin = transform.position,
direction = transform.forward
};
RaycastHit hit;
ray.direction = ray.direction * 100;
if(transform.GetComponent
{
Debug.Log("hit = yes"));
}
但是通过 Physics射线收集就有效果
var hits = Physics.RaycastAll(ray, 10);
if (hits != null && hits.Length > 0)
{
Debug.Log("log="+hits[0].collider.name);
}



