Created
May 29, 2019 21:11
-
-
Save pr00thmatic/3f3aeca9a25b6576d81e908c4935ff2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MouseRaycastExample : MonoBehaviour { | |
public void MouseRaycast () { | |
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
RaycastHit hit; | |
if (Input.GetMouseButtonDown(0) && | |
Physics.Raycast(ray, out hit)) { | |
GameObject created = Instantiate(chispas); | |
created.transform.position = hit.point; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment