49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class TestCollision : MonoBehaviour
|
|
{
|
|
private void OnCollisionEnter(Collision collision)
|
|
{
|
|
Debug.Log("Collision Detected with " + collision.gameObject.name);
|
|
// throw new NotImplementedException();
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider collision)
|
|
{
|
|
Debug.Log("Trigger Detected with " + collision.gameObject.name);
|
|
// throw new NotImplementedException();
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
// Debug.Log($"{Input.mousePosition}");
|
|
// Debug.Log($"{Camera.main.ScreenToViewportPoint(Input.mousePosition)}");
|
|
|
|
// if (Input.GetMouseButtonDown(0))
|
|
// {
|
|
// Vector3 mousePos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane));
|
|
// Vector3 dir = mousePos - Camera.main.transform.position;
|
|
// dir = dir.normalized;
|
|
//
|
|
// Debug.DrawRay(Camera.main.transform.position, dir * 100.0f, Color.blue, 1.0f);
|
|
//
|
|
// RaycastHit hit;
|
|
// if (Physics.Raycast(Camera.main.transform.position, dir, out hit,100.0f))
|
|
// {
|
|
// Debug.Log($"Racast Camera 0 {hit.collider.gameObject.name}");
|
|
// }
|
|
// }
|
|
|
|
if (Input.GetMouseButtonDown(0))
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|