Синтаксис:
Используется csharp
public class RAYCH : MonoBehaviour {
private float dist =50f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Ray ray = new Ray (transform.position, transform.down);
RaycastHit hit;
if(Physics.Raycast(ray,out hit, dist)){
Debug.Log(hit.collider.name + ":"+ hit.distance);
//Debug.DrawRay(transform.position,transform.down,Color.red);
}
}
}
private float dist =50f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Ray ray = new Ray (transform.position, transform.down);
RaycastHit hit;
if(Physics.Raycast(ray,out hit, dist)){
Debug.Log(hit.collider.name + ":"+ hit.distance);
//Debug.DrawRay(transform.position,transform.down,Color.red);
}
}
}
пишет Type `UnityEngine.Transform' does not contain a definition for `down' and no extension method `down' of type `UnityEngine.Transform' could be found (are you missing a using directive or an assembly reference?), хотя я уверен что должно работать!!!
С другими направлениями проблем нет