Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Ray : MonoBehaviour {
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- if (Input.GetMouseButtonDown(0))
- {
- Vector3 mouse = Camera.main.ScreenToWorldPoint(Input.mousePosition);
- RaycastHit2D hit = Physics2D.Raycast(mouse, new Vector3(0, 0, 1), 100);
- // 可視化
- Debug.DrawRay(mouse, new Vector3(0, 0, 100), Color.blue, 1);
- // コンソール
- Debug.Log(hit.collider);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement