Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var par : ParticleEmitter;
- var damage = 2;
- function Update () {
- var hit : RaycastHit;
- // Use Screen.height because many functions (like this one) start in the bottom left of the screen, while MousePosition starts in the top left
- var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Input.mousePosition.x, Screen.height - Input.mousePosition.y,0));
- if (Input.GetMouseButtonDown(0)) {
- if (Physics.Raycast (ray, hit, 100, kDefaultRaycastLayers)) {
- Instantiate(par, hit.point, Quaternion.LookRotation(hit.normal));
- var otherObj : GameObject = hit.collider.gameObject;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment