2d Raycast From Mouse Code Example


Example: unity 2d raycast mouse

// detect object that was clicked using raycast  RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);   if(hit.collider != null) {     Debug.Log ("Target name: " + hit.collider.name); }

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable