Question by
Mutton · Jun 08, 2016 at 05:31 PM ·
raycastingraycasthit2d
2D raycasting in jave script isnt hitting collider
so i have had this problem for some time and i havent been able to fix it and im hoping someone can help me. i have searched the internet to find solutions but havent found any that worked so ive come to the conclusion that the problem lies within my code. my problem is that i cant seem to detect the raycast with collisions and i cant even see the ray cast with debug.drawray
var hit : RaycastHit2D = Physics2D.Raycast(transform.position,-Vector2.up);
if(hit.collider.tag == "Player") {
if (hit.collider == true) {
Debug.Log("tadah");
}
Debug.DrawRay(transform.position,hit);
}
Comment