Open manhiem opened 4 years ago
Ray raycast = fpsCam.ScreenPointToRay(touch.position); RaycastHit hit; Gizmos.color = Color.red; Vector3 direction = transform.TransformDirection(Vector3.forward) * 5;
if(Physics.Raycast(raycast, out hit)) { Gizmos.DrawRay(transform.position, direction); if(hit.collider.name == "PlayerTag") { target.TakeDamage(damage); text.text = "Hit"; } }
//not working...
Ray raycast = fpsCam.ScreenPointToRay(touch.position); RaycastHit hit; Gizmos.color = Color.red; Vector3 direction = transform.TransformDirection(Vector3.forward) * 5;
//not working...