how to make the character look at the object and when clicked on mouse0 the object is removed with sound?
3D
I didn’t have much time to test it but i think this might give you an idea were to continue, there are some improvements you can make to the code.
public AudioClip audio;
void Update()
{
RaycastHit hit;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);//Detect the position of the mouse, the center of the screen
if (Physics.Raycast(ray, out hit))//generate the ray
{
if (Input.GetMouseButtonDown(0))
{
Destroy(hit.collider.gameObject);//Destroy the object the ray hit
AudioSource.PlayClipAtPoint(audio, transform.position); //PLAYS THE SOUND
}
}
}