void Raycasting() { RaycastHit hit; Physics.Raycast(transform.position, transform.up, out hit, range); Debug.DrawRay(transform.position, transform.up * range, Color.red); if (hit.collider != null) { if (hit.collider.tag == "Player") { float distance = hit.distance; isDetectionEnable = false; SmartHomeServer.InsertUltrasoundData(name, distance); } } }
void Raycasting() { RaycastHit hit; Physics.Raycast(transform.position, transform.up, out hit, range); // Debug.DrawRay (transform.position, transform.up * range, Color.red); if (hit.collider != null) { if (hit.collider.tag == "Player") { // SetTemps(Time.time); distance = hit.distance; // Debug.Log(temps); detection = false; smartHomeServeScript.InsertUltrasoundData(name, distance); // Debug.Log (""+timestamp +" - "+ name +" - "+ distance); } } }