lexonegit / Unity-2D-Raycast-Hit-Detection

Unity 2D Raycast hit detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Usage

  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

  • This gif shows the 4 levels of detection complexity

About

Unity 2D Raycast hit detection

License:MIT License


Languages

Language:C# 100.0%