Unity 2D Raycast Hit Detection by lexonegit - 1


Unity 2D Raycast Hit Detection

Unknown VersionMIT LicenseUpdated 126 days agoCreated on February 27th, 2020
Go to source

2D Raycast Hit Detection

2D Raycast Hit Detection is a tool for detecting if a moving object hit something using raycasting. It is useful for when you need more precise detection quality or the object is moving very fast (a bullet for example)

Note that this is not a 100% user friendly script. You most likely need to modify the script to suit your needs. Also with a bit of tinkering this should be easy to convert for 3D games as well


  1. Add Sensors.cs to a gameObject
  2. Assign the 3 transforms in the inspector
  3. Tweak the options to see what works the best

I recommend looking at the included ExampleProject for a better understanding

Show all projects by lexonegit