This commit is contained in:
2025-05-13 05:19:58 +03:00
parent 853edaf0b4
commit 472b2aee18
1034 changed files with 41844 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
using UnityEngine;
using System.Collections;
public class RaycastTester : MonoBehaviour {
public GameObject target;
public float distance = 100;
// Use this for initialization
void Start () {
}
private void FixedUpdate() {
if (target != null) {
var src = transform.position;
var dst = target.transform.position;
var hit = Physics2D.Raycast(src, (dst - src).normalized, distance, 1 << target.gameObject.layer);
if (hit.rigidbody != null) {
Debug.Log("!!!Hit collider: " + hit.collider.name);
}
else {
Debug.Log("!!!Nothing hit");
}
Debug.DrawLine(src, dst);
}
}
// Update is called once per frame
void Update () {
}
}