Hi, hope I am not asking something that has already been asked. I looked but was having trouble finding a solution to my issue.
I am trying to implement a swipe transition into our 2D game. I am trying to use Physics.Raycast, and filter by layermask, since I have multiple colliders overlapping (one of my colliders will be only for the swipe, and it overlaps all other colliders in the scene). It isn’t working for me. Here is my code:
RaycastHit hit;
Ray ray = camOrig.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask.NameToLayer("SwipeCollider")))
I tried my camera with and without the Physics Raycast2D component. It doesn’t work with anything I have done. And I know my swipe script works since I tested it using OnMouseOver to test when my mouse was over the collider. The only reason I can’t use OnMouseOver for every scene is because I have multiple intersecting 2D colliders.
Any advice? Is there something that I am missing?
Thanks in advance for any help!